I have a list of positive integers in a file called "scores.txt" that is located on my C drive at the address I listed in the program.
I have been given this program by my instructor to open the file up so I can read it. It also has a while loop with an end-of file control within it that I don't really understand but I am working on that.
I have defined a file pointer & I have connected that file with fopen() but it still cannot find it and displays "Error . . .etc".
What am I doing wrong?
Code:#include <stdio.h> int main(void) { FILE *scores; int score; scores = fopen("C:\\scores.txt","r"); if (scores == NULL) printf("Error opening input file\n"); else { while (feof(scores) <= 0) { fscanf(scores,"%d",&score); printf("%d\n",score); } } fclose(scores); system("pause"); return(0); }