6 Replies Latest reply: Oct 30, 2009 1:40 PM by galois
galois Level 1 Level 1 (0 points)
If you run this code compiled with gcc 4.2 (Xcode 3.2) you get an empty string. ostringstream doesn't convert int values to string!

Please, test this code with gcc compiler.

#include <iostream>
#include <sstream>

int main()
{
std::ostringstream stream;
stream << 45;
std::string str = stream.str();
std::cout << str; // empty output
return 0;
}

MacBook Pro 15" 2.4Ghz 2GB 500GB, Mac OS X (10.6.1)