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
문제
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 ?
해결책
제휴하지 않습니다 StackOverflow