------- Comment #3 from paolo dot carlini at oracle dot com 2009-07-13 19:59 ------- The pointers are in some sense independent, but in this exact technical sense: a seekg ends up calling the seekoff fstream virtual and therefore the mode becomes 'uncommitted', neither read mode neither write mode. Successive writes are therefore well defined and proceed exactly from the place where the last read took place. Alternately, you could achieve the same net effect by stopping reading when end of file is extracted: in C, and C++, this is a special case, which also leads to 'uncommitted' mode, thus the following writes are well defined - evidently in this case the user wants to append. But you can find many testcases about all the various behaviors in the testsuite. Since this is free software I also encourage you to browse the actual implementation: the last special case, for example, is very clear toward the end of basic_filebuf::underflow.
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40732