I made a simple program that reads a file and prints the contents of the file to the output.
It prints the file contents to the output like it should, but there's a strange question mark at the end of it. I typed, ./prog foobar into the Terminal and it printed the following.Code:
int main(int argc, char *argv)
printf("USAGE: %s [filename]\n", argv);
FILE *in = (fopen(argv, "r"));
while (file != EOF)
file = fgetc(in);
There is no question mark at the end of the foobar file. Is it printing the terminating null byte? Can someone explain this to me?Code: