int a, b;
int count = sscanf(array, "%*s %d %d", &a, &b);
if (count == 3) // then you matched three tokens, proceed, else failed to match
To get integer from string
Domanda
I am in trouble about getting integer from string and using it. I have:
char *string = "I 17 24 flying bits";
I want to take 17 and 24 as integer and use them. Pointer casting is out of question, how can i get those integers and use them ?
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow