I am trying to convert the std::string Number3 = "0.31" to a double in the code below.
I have used a MessageBox to show the result.
What happens is that double Convert is returning the value of: 0
What I have discovered is that if I instead would have written Number3 = "1.31",
Convert would have returned: 1
So it seems that the decimals is dissapearing in the conversion.
What could I be doing wrong here ?
stringstream Number1;
std::string Number2;
std::string Number3 = "0.31";
double Convert = atoi(Number3.c_str());
Number1 << Convert;
Number2 = Number1.str();
String^ NumberNew = gcnew String(Number2.c_str());
MessageBox::Show(NumberNew);