summaryrefslogtreecommitdiff
path: root/src/stdio/fscanf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/fscanf.c')
-rw-r--r--src/stdio/fscanf.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/stdio/fscanf.c b/src/stdio/fscanf.c
new file mode 100644
index 00000000..adbb753c
--- /dev/null
+++ b/src/stdio/fscanf.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include "stdarg.h"
+#include "nonstd/internal.h"
+#include "nonstd/io.h"
+
+/** read formatted input from a file stream **/
+int fscanf(FILE * restrict stream, const char * restrict format, ...)
+{
+ int ret = 0;
+ va_list ap;
+ struct io_options opt = {0};
+ opt.fnname = "fscanf";
+ opt.stream = stream;
+ va_start(ap, format);
+ ret = __scanf(&opt, format, ap);
+ va_end(ap);
+ /*
+ RETURN_SUCCESS(the number of input items assigned);
+ RETURN_FAILURE(CONSTANT(EOF));
+ */
+ return ret;
+}
+
+/***
+reads formatted input from ARGUMENT(stream). The format of ARGUMENT(format) at
+the variadic arguments is the same as that for FUNCTION(scanf).
+***/
+/*
+STDC(1)
+*/