diff liboctave/file-ops.cc @ 1802:8173b1fa052d

[project @ 1996-01-29 06:10:18 by jwe]
author jwe
date Mon, 29 Jan 1996 06:18:29 +0000
parents 6302d8d06319
children 1b57120c997b
line wrap: on
line diff
--- a/liboctave/file-ops.cc	Mon Jan 29 06:03:49 1996 +0000
+++ b/liboctave/file-ops.cc	Mon Jan 29 06:18:29 1996 +0000
@@ -26,6 +26,8 @@
 #endif
 
 #include <cerrno>
+#include <cstdio>
+#include <cstdlib>
 #include <cstring>
 
 #ifdef HAVE_UNISTD_H
@@ -34,6 +36,7 @@
 #endif
 
 #include "file-ops.h"
+#include "lo-error.h"
 #include "statdefs.h"
 
 // These must come after <sys/types.h> and <sys/stat.h>.
@@ -221,6 +224,26 @@
   return rmdir (name.c_str ());
 }
 
+string
+oct_tempnam (void)
+{
+  string retval;
+
+  char *tmp = tempnam (0, "oct-");
+
+  if (tmp)
+    {
+      retval = tmp;
+
+      free (tmp);
+    }
+  else
+    (*current_liboctave_error_handler) ("can't open temporary file!");
+
+  return retval;
+}
+
+
 int
 oct_umask (mode_t mode)
 {