summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2016-09-17 17:41:06 +0200
committerGitHub <noreply@github.com>2016-09-17 17:41:06 +0200
commitd250f06550b14dae0f474d2976f4a57837c7318a (patch)
tree8c456df8f475c51bceb7eca915b8bfd0f8072dcf
parent18b64f1dcfe3364ff2c6fef021de7409a6f858de (diff)
parent8ed241a1f018c2b5b557dc07b0cce8e4cfc826e8 (diff)
downloadNim-d250f06550b14dae0f474d2976f4a57837c7318a.tar.gz
Merge pull request #4790 from rudis/devel-mkstemp
posix: add mkstemp
-rw-r--r--lib/posix/posix.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim
index bd69b2328..bdc0dd058 100644
--- a/lib/posix/posix.nim
+++ b/lib/posix/posix.nim
@@ -2653,6 +2653,12 @@ proc poll*(a1: ptr TPollfd, a2: Tnfds, a3: int): cint {.
 proc realpath*(name, resolved: cstring): cstring {.
   importc: "realpath", header: "<stdlib.h>".}
 
+proc mkstemp*(tmpl: cstring): cint {.importc, header: "<stdlib.h>".}
+  ## Create a temporary file.
+  ##
+  ## **Warning**: The `tmpl` argument is written to by `mkstemp` and thus
+  ## can't be a string literal. If in doubt copy the string before passing it.
+
 proc utimes*(path: cstring, times: ptr array[2, Timeval]): int {.
   importc: "utimes", header: "<sys/time.h>".}
   ## Sets file access and modification times.