Jan 18, 2008

stringstream bug? Part 2

It actually appeared to be a correct behavior!
See gcc bug#31456.
The following example works as expected:

#include <iostream>
#include <sstream>

using namespace std;

int main()
{
ostringstream ss("Test",ios::out | ios::app );
cout << "#1: " << ss.str() << endl;

ss << "--";
cout << "#2: " << ss.str() << endl;
return 0;
}

Output:

#1: Test
#2: Test--

No comments: