This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/45628] std::fstream::tellg invalidates I/O buffer
- From: "paolo dot carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Sep 2010 12:37:02 -0000
- Subject: [Bug libstdc++/45628] std::fstream::tellg invalidates I/O buffer
- References: <bug-45628-18186@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from paolo dot carlini at oracle dot com 2010-09-10 12:36 -------
To clarify: when we start reading in a buffered mode, the first underflow reads
the buffer and leaves the physical file at the first char beyond the buffer. If
we do afterwards a seek to the current reading position, belonging to the
buffer, the physical position along the file also changes of course, an
underlying fseek is performed. Then, if we don't refresh the buffer with a new
underflow, an inconsistency is born: the physical position along the file
doesn't correspond to the first char after the buffer and the next underflow
will read from the wrong position.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45628