summaryrefslogtreecommitdiff
path: root/src/stdio/tmpfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/tmpfile.c')
-rw-r--r--src/stdio/tmpfile.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/stdio/tmpfile.c b/src/stdio/tmpfile.c
new file mode 100644
index 00000000..7143b491
--- /dev/null
+++ b/src/stdio/tmpfile.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+
+/* open a temporary file stream */
+FILE * tmpfile(void)
+{
+ char *path = "FIXME: A temporary file name *not* calling tmpnam()";
+ FILE *f = fopen(path, "w+");
+ if (f) {
+ /* FIXME: set flag for temporary in FILE struct */
+ } else {
+ /* FIXME: set errno */
+ }
+
+ /*
+ RETURN_SUCCESS(a pointer to the temporary file stream);
+ RETURN_FAILURE(CONSTANT(NULL));
+ */
+ return f;
+}
+
+/***
+creates a temporary binary file stream for update (as
+when ARGUMENT(mode) is specified as LITERAL("wb+") to FUNCTION(fopen)).
+The file stream will be automatically removed when closed by FUNCTION(fclose)
+or when the program exits.
+***/
+
+/*
+IMPLEMENTATION(Whether the temporary file is removed if the program terminates abnormally)
+*/
+/*
+STDC(1)
+*/