+ 1
How to use strtol function in C to convertt string into integer.
3 odpowiedzi
+ 3
* For C-String to int use `atoi`
http://en.cppreference.com/w/c/string/byte/atoi
* For C-String to long use `strtol`
http://www.cplusplus.com/reference/cstdlib/strtol/
Hth, cmiiw
+ 4
You can also use input string streams for this purpose.
+ 1
int x;
string y = ''123456'';
stringstream ston(y) ;
ston >> x;