Original Post
I am using C++. I'm trying to convert a string to an int, but I have this problem. The first string converts to an int, but the second one doesn't. It doesn't get set at all and becomes whatever funny number is in memory. Anyone able to help?
int nNumberOne,nNumberTwo;
g_StrStream.str("5");
g_StrStream>>nNumberOne;//convert string to int
g_StrStream.str("2");
g_StrStream>>nNumberTwo;//convert string to int
g_Log<<"nNumberOne="<<nNumberOne<<" nNumberTwo="<<nNumberTwo<<endl;
//nNumberOne=5 , nNumberTwo=56465466 (some funny number)