6 main (int argc
, char *argv
[])
8 const wchar_t in
[] = L
"7 + 35 is 42";
20 n
= swscanf (in
, L
"%d + %d is %d", &a
, &b
, &c
);
21 if (n
!= 3 || a
+ b
!= c
|| c
!= 42)
23 printf ("*** FAILED, n = %Zu, a = %d, b = %d, c = %d\n", n
, a
, b
, c
);
28 n
= swscanf (L
"one two three !!", L
"%s %S %s %c%C",
29 buf1
, wbuf2
, buf3
, &c4
, &wc5
);
30 if (n
!= 5 || strcmp (buf1
, "one") != 0 || wcscmp (wbuf2
, L
"two") != 0
31 || strcmp (buf3
, "three") != 0 || c4
!= '!' || wc5
!= L
'!')
33 printf ("*** FAILED, n = %Zu, buf1 = \"%s\", wbuf2 = L\"%S\", buf3 = \"%s\", c4 = '%c', wc5 = L'%C'\n",
34 n
, buf1
, wbuf2
, buf3
, c4
, (wint_t) wc5
);