views:

49

answers:

3

I only see strings with only numbers. this is my string. SMUL 9 A B How can I get the number 9 as int type. Other possible string may be: SMUL 13 A B SMUL 43 100 21

+2  A: 

Hello there, try your luck with atoi

phunehehe
+1  A: 

You can use the atoi library function:

   int atoi(const char *nptr);
Nathan Fellman
A: 

atoi is bad, there is no error-handling, eg: atoi("0")==atoi("foobar") ! use strtol or sscanf instead.