7 sscanf ("abc ", "abc %n", &n
);
8 printf ("t1: count=%d\n", n
);
20 #define SCAN(INPUT, FORMAT, VAR, EXP_RES, EXP_VAL) \
22 retval = sscanf (INPUT, FORMAT, &VAR); \
23 printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \
24 INPUT, FORMAT, retval, (long int) VAR); \
25 result |= retval != EXP_RES || VAR != EXP_VAL
27 SCAN ("12345", "%ld", N
, 1, 12345);
28 SCAN ("12345", "%llllld", N
, 0, -1);
29 SCAN ("12345", "%LLLLLd", N
, 0, -1);
30 SCAN ("test ", "%*s%n", n
, 0, 4);
31 SCAN ("test ", "%2*s%n", n
, 0, -1);
32 SCAN ("12 ", "%l2d", n
, 0, -1);
33 SCAN ("12 ", "%2ld", N
, 1, 12);
37 retval
= sscanf ("1 1", "%d %Z", &n
, &N
);
38 printf ("sscanf (\"1 1\", \"%%d %%Z\", &n, &N) => %d, n = %d, N = %ld\n", \
40 result
|= retval
!= 1 || n
!= 1 || N
!= -1;
46 main (int argc
, char *argv
[])
53 result
|= fflush (stdout
) == EOF
;