like so on linux, tellg() returns 0, but on windows it returns a large number.
if i read 4 bytes, both tellg() calls will be 4 bigger. tellg() starts behaving properly on windows when i set the binary flag.
what is this number? (or is it undefined?)
Thanks for your time.
I haven't had any experience with Linux programming, but under MSVC++ at least, tellg() returns the type std::ifstream::pos_type.
I always assumed that this was typedef'ed to a long, but it turns out to be a complex type, although I haven't found the definition of the struct yet.
If you're expecting an int or long for a return, the could account for the discrepancy.
Play
Lander Forever
!
well, if you try this
std::ifstream::pos_type cbeg = file.tellg(); int cbeg = file.tellg(); long cbeg = file.tellg(); int cbeg = static_cast<int>(file.tellg()); long cbeg = static_cast<long>(file.tellg()); std::cout << "fd position = (" << cbeg << ")\n";
it still spits out the same number
also it does the same with MSVC++ and Dev-C++ (so it's win32 version of stl) ...?