File: tst_wscanf.c

package info (click to toggle)
glibc 2.24-11%2Bdeb9u3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 225,316 kB
  • sloc: ansic: 996,116; asm: 261,826; sh: 10,483; makefile: 9,849; cpp: 4,169; python: 3,971; perl: 2,254; awk: 1,753; pascal: 1,521; yacc: 291; sed: 80
file content (29 lines) | stat: -rw-r--r-- 598 bytes parent folder | download | duplicates (43)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <string.h>
#include <wchar.h>

int
main (int argc, char *argv[])
{
  int n;
  int result = 0;
  char buf1[20];
  wchar_t wbuf2[20];
  char c3;
  wchar_t wc4;
  int d;

  puts ("Test 1");

  n = wscanf (L"%s %S %c%C %d", buf1, wbuf2, &c3, &wc4, &d);

  if (n != 5 || strcmp (buf1, "Hello") != 0 || wcscmp (wbuf2, L"World") != 0
      || c3 != '!' || wc4 != L'!' || d != 42)
    {
      printf ("*** FAILED, n = %d, buf1 = \"%s\", wbuf2 = L\"%S\", c3 = '%c', wc4 = L'%C', d = %d\n",
	      n, buf1, wbuf2, c3, (wint_t) wc4, d);
      result = 1;
    }

  return result;
}