This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
seekp(0) in stringstream
- From: "Xu, Qiang (XSSC SGP)" <Xu dot Qiang at xssc dot sgp dot xerox dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 7 Oct 2002 18:32:42 +0800
- Subject: seekp(0) in stringstream
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