You have to remember that the EOF
flag is not set until you actually try to read from beyond the end of the file.
With fseek
clearing the flag, it does this even if you seek to beyond the end of the file. And it works because the flag will be set again next time you read.
That is why it's a bad idea to have loops such as while (!feof(...))
, as those will then loop once to many without detecting the actual end of the file condition.