+ 1

How to use strtol function in C to convertt string into integer.

13th Aug 2019, 8:08 PM
Kesh∆v
Kesh∆v - avatar
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
13th Aug 2019, 9:02 PM
Ipang
+ 4
You can also use input string streams for this purpose.
14th Aug 2019, 1:47 AM
Sonic
Sonic - avatar
+ 1
int x; string y = ''123456''; stringstream ston(y) ; ston >> x;
14th Aug 2019, 8:39 AM
Franky BrainBox
Franky BrainBox - avatar