daily pastebin goal
64%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "123 35   123 0    0      0       817 0    0   0   0"
  2.    
  3. int a, b, c;
  4. if( sscanf(string, "%d %d %d", &a, &b, &c) == 3)
  5.   printf("the third number is %dn", c);
  6.    
  7. int a;
  8. if( sscanf(string, "%*d %*d %d", &a) == 1)
  9.   printf("the third number is %dn", a);
  10.    
  11. const char *input = "...";
  12. int value;
  13.  
  14. // here we use the '*' modifier to discard the input from our string
  15. sscanf("%*i %*i %i", &value);
  16.  
  17. // value now magically has the value you need.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top