Originally posted by darfader
so is it an error, no not error, mistake to check for EOF with fgets() when it returns NULL ?
Correct. Why check for things the function doesn't return? That's like writing a function that returns either 1 or 0, and checking it to see if it returns 2.