File: scanf5.c

package info (click to toggle)
glibc 2.36-9%2Bdeb12u12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 299,992 kB
  • sloc: ansic: 1,055,666; asm: 324,942; makefile: 15,198; python: 12,603; sh: 10,884; cpp: 5,685; awk: 1,883; perl: 518; yacc: 292; pascal: 182; sed: 39
file content (21 lines) | stat: -rw-r--r-- 347 bytes parent folder | download | duplicates (42)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char *argv[])
{
  int a, b;

  a = b = -1;
  sscanf ("12ab", "%dab%n", &a, &b);
  printf ("%d, %d\n", a, b);
  if (a != 12 || b != 4)
    abort ();

  a = b = -1;
  sscanf ("12ab100", "%dab%n100", &a, &b);
  printf ("%d, %d\n", a, b);
  if (a != 12 || b != 4)
    abort ();
  return 0;
}