Mail Archives: djgpp/1998/10/26/04:31:50
Hi,
I'm using the gpp-e11b (egcs) alpha and have a problem with strstreams.
The following code
int main()
{
for (int i = 0; i < 2; i++)
{
strstream os;
os << "test ";
if (i == 0) os << "first";
os << endl;
string s = os.str();
cout << s;
}
}
fails to properly terminate the string s. (output is "test
first\ngarbagegarbage...test\ngarbage..." It seems the str() function does
not append the '\0' terminator to the string correctly. Is this a bug, or
am I doing something wrong ?
Thanks,
Koen.
- Raw text -