This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/14174] New: bug and workaround for stringstream tellg and operator>>
- From: "bugzilla dot 20 dot kuhfladen at spamgourmet dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Feb 2004 13:10:23 -0000
- Subject: [Bug libstdc++/14174] New: bug and workaround for stringstream tellg and operator>>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
There seems to be a bug in stringstream. Consider the following code segment.
It yields:
abc
xyz
But should yield:
abc
bc
The workaround is to add a white space to "abc", i.e.: s << "abc ".
Regards
Uwe Sassenberg
Science-D-Visions
--------------------------8<--------------------------
std::stringstream s;
std::string a;
s << "abc";
// here it works
s >> a;
std::cout << a << std::endl;
// set get-position to character 'b' in "abc"
s.seekg(1);
// put some other content into a
a = "xyz";
// here it doesn't work
s >> a;
std::cout << a << std::endl;
--------------------------8<--------------------------
--
Summary: bug and workaround for stringstream tellg and operator>>
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bugzilla dot 20 dot kuhfladen at spamgourmet dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14174