tellg/tellp() can change state of stream ?

Paolo Carlini pcarlini@suse.de
Fri May 20 01:14:00 GMT 2005


Hi Canal, Vorfeed wrote:

>Zidrav 1.1 does not work with gcc 3.4.3 ...
>
>Since it's trivial program I tried to understand what goes on and reduced testcase to this:
>
The issue here is that tellg() (like seekg() and so on) basically do a
seek and a seek (or a flush) is generally needed to succesfully switch
from read to write (and viceversa). C++ openmode "in|out|trunc" means
"w+" in C terms (see 27.8.1.3/2) and the C standard is very clear about
the above: see its 7.19.5.3/6 (if you ask me, the C++ standard itself
maybe should be a little more explicit about those matters, agreed ;)

Paolo.



More information about the Libstdc++ mailing list