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 http://thecrazyprogrammer.blogspot.com/
Last edited on
> what is the problem.

Guess: you are doing something like:

1
2
3
4
5
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.