2 #define STDIO_H <iostdio.h>
10 sscanf ("abc ", "abc %n", &n
);
11 printf ("t1: count=%d\n", n
);
20 #define SCAN(INPUT, FORMAT, VAR) \
22 retval = sscanf (INPUT, FORMAT, &VAR); \
23 printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \
24 INPUT, FORMAT, retval, (long)VAR);
26 SCAN ("12345", "%ld", N
);
27 SCAN ("12345", "%llllld", N
);
28 SCAN ("12345", "%LLLLLd", N
);
29 SCAN ("test ", "%*s%n", n
);
30 SCAN ("test ", "%2*s%n", n
);
31 SCAN ("12 ", "%l2d", n
);
32 SCAN ("12 ", "%2ld", N
);