I don't know how to ask this question as this looks very trivial, but surprisingly it's not working in my project in the visual studio. It works in the sample program. Does any optimization flag are the reason behind this?
std::ostringstream s;
s << "player";
s << 1;
cout << s.str() << endl;
const char* pStr = s.str().c_str();
cout << pStr<<endl;
In sample program it outputs
player1
player1
but in my project const char* pStr
is having ""
value. Can anyone provide suggestions on what might be happening here?