+SCM_DEFINE (scm_mkstemp, "mkstemp!", 1, 0, 0,
+ (SCM tmpl),
+ "mkstemp creates a new unique file in the file system and\n"
+ "returns a new buffered port open for reading and writing to\n"
+ "the file. @var{tmpl} is a string specifying where the\n"
+ "file should be created: it must end with @code{XXXXXX}\n"
+ "and will be changed in place to return the name of the\n"
+ "temporary file.\n")
+#define FUNC_NAME s_scm_mkstemp
+{
+ char *c_tmpl;
+ int rv;
+
+ SCM_STRING_COERCE_0TERMINATION_X (tmpl);
+ SCM_VALIDATE_STRING_COPY (1, tmpl, c_tmpl);
+ SCM_SYSCALL (rv = mkstemp (c_tmpl));
+ if (rv == -1)
+ SCM_SYSERROR;
+ return scm_fdes_to_port (rv, "w+", tmpl);
+}
+#undef FUNC_NAME
+