Last record is repeated two times

I am working with binary file in c++. I can write in the file but when i displaying the file content on the screen than the last record is displaying two times. Plz anyone tell me what is the problem.

For programs and projects related to c and c++, plz visit my blog
Last edited on
> what is the problem.

Guess: you are doing something like:

while( !file.eof() )
     try to read a record 
     display the record

After the last record is read and displayed, try to read a record fails; and without checking for failure it is getting displayed.

Topic archived. No new replies allowed.