summaryrefslogtreecommitdiff
path: root/src/stdio/fprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/fprintf.c')
-rw-r--r--src/stdio/fprintf.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/stdio/fprintf.c b/src/stdio/fprintf.c
new file mode 100644
index 00000000..053277d7
--- /dev/null
+++ b/src/stdio/fprintf.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include "stdarg.h"
+#include "nonstd/io.h"
+#include "nonstd/internal.h"
+
+/** write formatted output to a file stream **/
+int fprintf(FILE * restrict stream, const char * restrict format, ...)
+{
+ int ret = 0;
+ va_list ap;
+ struct io_options opt = {0};
+ opt.fnname = "fprintf";
+ opt.stream = stream;
+ va_start(ap, format);
+ ret = __printf(&opt, format, ap);
+ va_end(ap);
+ /*
+ RETURN_SUCCESS(the number of characters written);
+ RETURN_FAILURE(NEGATIVE());
+ */
+ return ret;
+}
+
+/***
+writes a formatted string to ARGUMENT(stream). The format of ARGUMENT(format)
+and the variadic arguments is the same as that for FUNCTION(printf).
+***/
+/*
+STDC(1)
+*/