cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Last record is repeated two times
Last record is repeated two times
Dec 10, 2012 at 1:26pm UTC
sareneeru
(2)
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
Dec 10, 2012 at 1:28pm UTC
Dec 10, 2012 at 1:38pm UTC
JLBorges
(13770)
> 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.