This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]