I would expect the following code to output hello5
. Instead, it only outputs hello
.
It seems to be a problem with trying to output an int to the ostringstream
.
When I output the same directly to cout
I receive 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 to be created by a problem in the Active Configuration 'Debug' in XCode 3.2 on Snow Leopard
Changing the Active Configuration in XCode from 'Debug' to 'Release' works as a workaround.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With