There is a strange problem. I invoke the inFile.tellg() in the seventh line. The code print the position of "get pointer", and then print the characters one by one.
In fact, the program can't print the characters correct. After invoking inFile.tellg(), the "get pointer" will be drift x bytes. I don't know why. And when I modify the IOFile.txt, the drift value x will change.
1. what's the meaning of tellg() return value?
2. why "get pointer" will be drifted after invoking tellg()?
I compile code using GCC 3.4.5 in windows7.
Thanks a lot
In reference to tellg()
Get position of the get pointer.
Returns the absolute position of the get pointer.
The get pointer determines the next location in the input sequence to be read by the next input operation.
This behavior really bugs me too... there is, I think, little excuse for such poor tracking, particularly as the newline handling and the like is performed by the C or C++ standard library.