Hello,
I am trying to make my program read a file thats on my desktop.
When I run the code all I get is smiley faces.
What is the problem with my code?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
int main (){
char c;
char inputText[500];
FILE* inputFile;
inputFile=fopen("C:\\Documents and Settings\\User\\My Documents\\GPA.txt","r");
if (inputFile==NULL){
printf("Failed to open");
exit(-1);
}
fgets(inputText, 500, inputFile);
while ((c=getc(inputFile)!=EOF)){
printf("%c",c);
}
fclose(inputFile);
system("Pause");
}