Very stupid fgets question

Started by
2 comments, last by Kurioes 21 years, 4 months ago
I just can''t find anything wrong here:

#include header files...

FILE *file = fopen("existing text file.txt", "rt");
char buffer[8]; // yes really eight

fgets(buffer, 8, file); // <---- this line screws up
 
That should work AFAIK but it doesn''t. I must be making some very stupid mistake... but which one? Anyone?
Advertisement
you sure the text file exists that you try to open? see if (after the opening attempt) that the FILE structure is not null.

are you getting any error messages?
Hmm... i thought the file existed but I''ll check..
That would really be a STUPID mistake. I do that all the time.

...

*after trying*
Aww man, I''m sooo stupid.

Thanks for the help... it works now.
Did I already say I''m stupid?

I am STUPID

This topic is closed to new replies.

Advertisement