I do not know much about the sscanf function, but what I am trying to do is iterate through a line of integers. Given the variable
char *lineOfInts >
char *lineOfInts
Use "%n" to record the count of characters scanned.
"%n"
char *lineOfInts; char *p = lineOfInts; while (*p) { int n; int number; if (sscanf(p, "%d %n", &number, &n) == 0) { // non-numeric input break; } p += n; printf("Number: %d\n", number); }