Converting all strings in a txt file to lowercase in c
<p>I am assigned to convert all strings to lowercase in a txt file and then output it in a new txt file but i cant seem find anywhere how to do it. Any help would be very appriciated! Thank you This is what i have till now but there is the y at the end so im thinking if there is a better way to do it or if i can remove the y with the two dots on top..</p>

<pre><code>#include&lt;stdio.h&gt;
#include&lt;process.h&gt;

void main() {
   FILE *fp1, *fp2;
   char a;

   fp1 = fopen("test.txt", "r");
   if (fp1 == NULL) 
   {
      puts("cannot open this file");
      exit(1);
   }

   fp2 = fopen("test1.txt", "w");
   if (fp2 == NULL) {
      puts("Not able to open this file");
      fclose(fp1);
      exit(1);
   }

   do
   {
      a = fgetc(fp1);
      a = tolower(a);
      fputc(a, fp2);
   } while (a != EOF);

   fcloseall();
   getch();
}
</code></pre>