Read the string file (file name: data.txt)
Save the output file(same file) after conversion to uppercase
#include <stdio.h>
#include <stdlib.h>
void main()
{
FILE *pf;
FILE *fp=fopen("data.txt","w");
char ch;
pf=fopen("data1.txt", "r");
ch = fgetc(pf);
fprintf(fp,"%c",ch);
while (ch!=EOF)
{
if (ch >= 'a' && ch <= 'z') ch = ch - 'a' + 'A'; else if (ch >= 'A' && ch <= 'Z') ch = ch - 'A' + 'a';
fprintf(fp,"%c",ch);
ch = fgetc(pf);
}
fclose(fp);
fclose(pf);
}
system("del data.txt");
system("ren data1.txt data.txt")