Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

ostringstream doesn't work with int

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)

Posted on Oct 28, 2009 8:24 PM

Reply
6 replies

ostringstream doesn't work with int

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.