xref: /haiku/src/tests/system/libroot/posix/tst-wscanf.c (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 #include <stdio.h>
2 #include <string.h>
3 #include <wchar.h>
4 
5 
6 int
7 main(int argc, char *argv[])
8 {
9 	int n;
10 	int result = 0;
11 	char buf1[20];
12 	wchar_t wbuf2[20];
13 	char c3;
14 	wchar_t wc4;
15 	int d;
16 
17 	puts("Test 1");
18 
19 	n = wscanf(L"%s %S %c%C %d", buf1, wbuf2, &c3, &wc4, &d);
20 
21 	if (n != 5 || strcmp (buf1, "Hello") != 0 || wcscmp (wbuf2, L"World") != 0
22 		|| c3 != '!' || wc4 != L'!' || d != 42) {
23 		printf ("*** FAILED, n = %d, buf1 = \"%s\", wbuf2 = L\"%S\", c3 = '%c', wc4 = L'%C', d = %d\n",
24 			n, buf1, wbuf2, c3, (wint_t) wc4, d);
25 		result = 1;
26 	}
27 
28 	return result;
29 }
30