How can i get the numerical value (convert it to int) from a string?
I only see strings with only numbers. this is my string. SMUL 9 A B How can I get the number 9 as 开发者_如何学Cint type. Other possible string may be: SMUL 13 A B SMUL 43 100 21
try your luck with atoi
You can use the atoi
library function:
int atoi(const char *nptr);
atoi is bad, there is no error-handling, eg: atoi("0")==atoi("foobar") ! use strtol or sscanf instead.
精彩评论