seekp(0) in stringstream
Xu, Qiang (XSSC SGP)
Xu.Qiang@xssc.sgp.xerox.com
Mon Oct 7 03:33:00 GMT 2002
hi, all:
i wrote a program using string stream.
part of it is as follows:
#include <sstream>
...
int i = 20005;
ostringsteam buf;
buf << i; // now buf.str() == "20005".
buf.seekp(0); // move the put pointer to the beginning of the stream.
buf << 6; // i expect buf.str() == "60005". but it is "6", instead.
in my understanding, when we move the put pointer to the beginning of
the string stream, and write something new into it, only the beginng
characters would be overwrited, the remaining characters should not be
affected. but the result of this program is contrary to what i expect.
anything wrong in my understanding? or is it a known buy with gcc 2.95.3?
my platform is Sun Sparc workstation with Sun OS 5. and my compiler is gcc
2.95.3.
thanks,
Regards,
Xu Qiang
More information about the Gcc-bugs
mailing list