Hi all,
I'm using fstream object to read a binary file, but I don't know if it reachs the end of the file, because the eof() function doesn't work for binary files. I always read one more time from the file.
That is to say, if I just write one int value to the file, and then I read it. but as a result, I entered the following loop two times. I know the read() fuction consider EOF as a valid content, but I have no solution. So my problem is how to decide the end of binary files
while(!infile.eof())
{
infile.read(...); // read one int value
}
Thanks.

the end of binary file
ds12will
Tyler Frugia
King Gamo
ofcourse it works, I wonder if there is some function can judge the end of binary file. I noticed that C run time library function feof() can do it, but how about C++ fstream objects
AuzzieFlyBoy
feof() instead of eof()