problem with fstream

This is a discussion on problem with fstream within the C++ Programming forums, part of the General Programming Boards category; Hi,
I have very strange problem with std::fstream. I want to read a simple two-column space-separated file with the following ...

It looks like the seek internal pointer of fstream is not moving. Any clues about this? I'm in RH with GCC3.4. ????? I don't get it :S Any ideas??? I'm starting to believe that my computer is possessed

Re: Problem with fstream

Thanks a lot for your time. I changed the data type to long long and it worked.

>> while(!file.eof())
> This is bad, see the FAQ

The eof that the FAQ talks about is from C, i think that the std::fstream::eof() function solves that problems, at least in my program works fine. Do you know if this is true for C++ (that the efo() works fine)?

There are similar issues with using eof() to control a loop in C++, although they are not exactly the same. If your original code was working, you would likely be outputting the last pair of values twice. Can you post your current version?

with the previous version I do get the last line printed twice. With this one I get a bad input instead of the repetition of the last line. Can you explain what does this happens? Or where can we read about it? I'd really appreciate it.

>> where can we read about it?
I have never seen it explained correctly, although I'm sure it is somewhere. I have explained it a couple times, but it would be hard to search for since I've posted more than a few times on here, and more than a few times on the subject. I will search for the thread or give an explanation later (tomorrow my time).