Namespaces
Variants
Views
Actions

Talk:cpp/io/basic istream/seekg

From cppreference.com
< Talk:cpp‎ | io

[edit] seekg and eofbit

This page tells that seekg clears eofbit, but I spent a lot of time seeking for an error. Result is next: if the flag eofbit was set, seekg can't do anything (but failbit was 0) and after calling seekg I got -1 from tellg. The solution was to call clear() before seekg to clear eofbit manually. I'm using gcc version 4.6.1. I don't know what standard says about this situation, but maybe this page should be corrected. --217.67.65.115 16:41, 11 March 2012 (PDT)

The standard seems to say that eofbit should be cleared -- section 27.7.2.3. 72.14.228.1 18:08, 11 March 2012 (PDT)