Back to index

glibc  2.9
scanf2.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 
00004 int
00005 main(int argc, char *argv[])
00006 {
00007     int point, x, y;
00008 
00009     point = x = y = -1;
00010     sscanf("0x10 10", "%x %x", &x, &y);
00011     printf("%d %d\n", x, y);
00012     if (x != 0x10 || y != 0x10)
00013       abort ();
00014     point = x = y = -1;
00015     sscanf("P012349876", "P%1d%4d%4d", &point, &x, &y);
00016     printf("%d %d %d\n", point, x, y);
00017     if (point != 0 || x != 1234 || y != 9876)
00018       abort ();
00019     point = x = y = -1;
00020     sscanf("P112349876", "P%1d%4d%4d", &point, &x, &y);
00021     printf("%d %d %d\n", point, x, y);
00022     if (point != 1 || x != 1234 || y != 9876)
00023       abort ();
00024   return 0;
00025 }