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