You don't show how you're opening the file, so the fail bit is probably set, which means the eof bit will not be set. If you care to show some more code, feel free to do so.

If you show more code, and want a response, put the code in code tags.