[BZ #6020]
[glibc/pb-stable.git] / stdio-common / scanf4.c
blobf9a91347458afdb6154cc8b4bd3159e702b67ae7
1 #include <stdio.h>
2 #include <stdlib.h>
4 int
5 main(int arc, char *argv[])
7 int res;
8 unsigned int val;
10 FILE *fp = fopen ("/dev/null", "r");
12 val = 0;
13 res = fscanf(fp, "%n", &val);
15 printf("Result of fscanf %%n = %d\n", res);
16 printf("Scanned format = %d\n", val);
18 res = fscanf(fp, "");
19 printf("Result of fscanf \"\" = %d\n", res);
20 if (res != 0)
21 abort ();
23 res = fscanf(fp, "BLURB");
24 printf("Result of fscanf \"BLURB\" = %d\n", res);
25 if (res >= 0)
26 abort ();
28 fclose (fp);
30 return 0;
31 return 0;