summaryrefslogtreecommitdiff
path: root/helpers/scanfmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/scanfmt.c')
-rw-r--r--helpers/scanfmt.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/helpers/scanfmt.c b/helpers/scanfmt.c
new file mode 100644
index 00000000..2d7bd73a
--- /dev/null
+++ b/helpers/scanfmt.c
@@ -0,0 +1,22 @@
+/*
+ * Test out ' flag in different locales.
+ * Michal Jaegermann
+ * March, 2014
+ */
+
+#include <stdio.h>
+#include <locale.h>
+#include <stdlib.h>
+int
+main(int argc, char **argv)
+{
+ double t;
+
+ if (argc == 1)
+ return 1;
+
+ setlocale(LC_ALL, getenv("LC_ALL"));
+ sscanf(argv[1], "%lf", &t);
+ printf("%.2f\n", t);
+ return 0;
+}