summaryrefslogtreecommitdiff
path: root/src/stdio/sprintf_s.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/sprintf_s.c')
-rw-r--r--src/stdio/sprintf_s.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/stdio/sprintf_s.c b/src/stdio/sprintf_s.c
new file mode 100644
index 00000000..223e84c8
--- /dev/null
+++ b/src/stdio/sprintf_s.c
@@ -0,0 +1,31 @@
+#include "stdio.h"
+#include "stdarg.h"
+
+/** write formatted output to a string **/
+int sprintf_s(char * restrict s, rsize_t n, const char * restrict format, ...)
+{
+ __C_EXT(1, 201112L);
+ int retval;
+ va_list ap;
+ va_start(ap, format);
+ retval = vsprintf(s, format, ap);
+ va_end(ap);
+ return retval;
+}
+
+/***
+The fn(sprintf) function writes a formatted string to the buffer at arg(s). The
+format of arg(format) and the variadic arguments is the same as that for
+fn(printf).
+***/
+
+/* UNSPECIFIED: ??? */
+/* UNDEFINED: ??? */
+/* IMPLEMENTATION: ??? */
+/* LOCALE: ??? */
+
+/* RETURN: the number of characters written, not including the final char(\0) */
+
+/*
+CEXT1(201112)
+*/