aboutsummaryrefslogtreecommitdiff
path: root/tests/core/test_sscanf_n.in
blob: 78142b3a0c63faf183d7461d473b67a1d9bd9667 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
      #include<stdio.h>
      int main() {
        char *line = "version 1.0";
        int i, l, lineno;
        char word[80];
        if (sscanf(line, "%s%n", word, &l) != 1) {
            printf("Header format error, line %d\n", lineno);
        }
        printf("[DEBUG] word 1: %s, l: %d\n", word, l);

        int x = sscanf("one %n two", "%s %n", word, &l);
        printf("%d,%s,%d\n", x, word, l);
        {
          int a, b, c, count;
          count = sscanf("12345 6789", "%d %n%d", &a, &b, &c);
          printf("%i %i %i %i\n", count, a, b, c);
        }
        return 0;
      }