aboutsummaryrefslogtreecommitdiff
blob: f9a91347458afdb6154cc8b4bd3159e702b67ae7 (plain)
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
30
31
32
#include <stdio.h>
#include <stdlib.h>

int
main(int arc, char *argv[])
{
  int res;
  unsigned int val;

  FILE *fp = fopen ("/dev/null", "r");

  val = 0;
  res = fscanf(fp, "%n", &val);

  printf("Result of fscanf %%n = %d\n", res);
  printf("Scanned format = %d\n", val);

  res = fscanf(fp, "");
  printf("Result of fscanf \"\" = %d\n", res);
  if (res != 0)
    abort ();

  res = fscanf(fp, "BLURB");
  printf("Result of fscanf \"BLURB\" = %d\n", res);
  if (res >= 0)
    abort ();

  fclose (fp);

  return 0;
  return 0;
}