From: Koen_Van_Herck AT xircom DOT com X-Lotus-FromDomain: XIRCOM To: djgpp AT delorie DOT com Message-ID: Date: Mon, 26 Oct 1998 10:28:07 +0100 Subject: strstream str() problem Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline Reply-To: djgpp AT delorie DOT com 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.