-- 2007/06/19 bbs backup --
suppose there're codes
while(!foo.eof()){
foo.getline(buf, num);
// do someting
}
it works
but binary maybe take this style or it read more once
foo.read(buf, size);
while(!foo.eof()){
// do something
foo.read(buf, size);
}
http://www.programmersheaven.com/mb/CandCPP/210340/210340/readmessage.aspx
On the last read cycle you still have a valid read, so eof() hasn't been
reached until you try and read past the last item. Try swapping your code
around slightly like in red above, it should work.
沒有留言:
張貼留言