Back to index

glibc  2.9
tst_wscanf.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <string.h>
00003 #include <wchar.h>
00004 
00005 int
00006 main (int argc, char *argv[])
00007 {
00008   int n;
00009   int result = 0;
00010   char buf1[20];
00011   wchar_t wbuf2[20];
00012   char c3;
00013   wchar_t wc4;
00014   int d;
00015 
00016   puts ("Test 1");
00017 
00018   n = wscanf (L"%s %S %c%C %d", buf1, wbuf2, &c3, &wc4, &d);
00019 
00020   if (n != 5 || strcmp (buf1, "Hello") != 0 || wcscmp (wbuf2, L"World") != 0
00021       || c3 != '!' || wc4 != L'!' || d != 42)
00022     {
00023       printf ("*** FAILED, n = %d, buf1 = \"%s\", wbuf2 = L\"%S\", c3 = '%c', wc4 = L'%C', d = %d\n",
00024              n, buf1, wbuf2, c3, (wint_t) wc4, d);
00025       result = 1;
00026     }
00027 
00028   return result;
00029 }