I expect the following code to output hello5 . Instead, it only displays hello . The problem seems to be related to trying to output int to ostringstream . When I output the same directly to cout , I get the expected input. Using Xcode 3.2 on Snow Leopard.
Thanks!
#include <iostream> #include <string> #include <sstream> using namespace std; int main(){ int myint = 5; string mystr = "hello"; string finalstr; ostringstream oss; oss << mystr << myint; finalstr = oss.str(); cout << finalstr; return 0; }
EDIT: see the answer I posted below. This seems like a problem in "Debugging" Active Configuration in Xcode 3.2 on Snow Leopard
source share