So far I have gotten the program to open the selected file and display the contents but I am unable to convert the contents to capital letters, I get an array of strange character and number combinations. Any pointers or guidance on what I need to add to this code to get it to function properly.
Code:
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *inFile;
FILE *outFile;
char fileName[13],line[256], descrip[10];
printf("\nEnter a file name:");
gets(fileName);
inFile=fopen(fileName, "w+");
outFile=fopen(fileName, "w+");
if (inFile==NULL)
{
printf("\nThe file %s was not successfully opened.", fileName);
printf("\nPlease check that the file curretly exists.\n");
exit(1);
}
printf("\nThe file has been sucecessfully opened for reading.\n");
while (fgets(line,256,inFile) !=NULL)
toupper(line);
fputs(line, inFile);
printf("%s", line);
fclose(inFile);
printf("\nPress any key to exit.....");
getchar();
return 0;
}