For my function prototype, I have FILE*character(FILE*)
The switch statement for case 2:
text=character(text);
break;
Function:
Code:
FILE*character(FILE*fname)
{
char text[81];
char fileName[13];
printf("\nPlease enter the name of the file you wish to open: ");
fgets(fileName, sizeof(fileName), stdin);
fileName[strlen(fileName)-1]='\0';
fname=fopen(fileName, "r");
if (fname==NULL)
{
printf("\nThe file cannot be opened.");
printf("\nPlease check that the file exists.");
exit(1);
}
while (fgets(text,81,fname) !=NULL)
printf("%s", text);
return fname;
}
What I am trying to do is open a file and display the text. But I haven't been able to do this yet. Once I can display the file, I will be able to count the characters, words, etc...
Magos,
Do I just take fname out and not even use it?