The program must translate the string into an integer. I tried to use the stoi function for this purpose, but it is not accepted - an error occurs:
'stoi' was not declared in this scope
In particular, I need to translate a string like such "5678906576" into an integer. I tried to replace it with atoi , using previously c_str . Writing:
string str = "5678906576"; cout << atoi(str.c_str())<< endl; I 1383939280 in the console 1383939280 .
Then I try the fromStdString().toInt() function from Qt Core . Writing:
string str = "5678906576"; cout << QString::fromStdString(str).toInt() << endl; I get 0.
Gentlemen, please explain why this and with what then should I replace the stoi .
I use Qt 4.7.4 QtCreator-2.4.1.
stoiyou much if I say that for your example,stoiwill not save you? you need astoll- Harry