about summary refs log tree commit diff
path: root/stdio-common/scanf5.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/scanf5.c')
-rw-r--r--stdio-common/scanf5.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/stdio-common/scanf5.c b/stdio-common/scanf5.c
new file mode 100644
index 0000000000..b52e853344
--- /dev/null
+++ b/stdio-common/scanf5.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+int
+main()
+{
+  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;
+}