Difference between revisions of "Ns mktemp"

From AOLserver Wiki
Jump to navigation Jump to search
(imported from WiKit id 601)
 
 
(2 intermediate revisions by the same user not shown)
Line 16: Line 16:
  
 
: Note that some implementations of mktemp are not so safe - it creates predictable/only a small number of variations - please consult your system's man pages if this might be an issue to you. AOLserver could potentially be improved to use mkstemp instead.
 
: Note that some implementations of mktemp are not so safe - it creates predictable/only a small number of variations - please consult your system's man pages if this might be an issue to you. AOLserver could potentially be improved to use mkstemp instead.
 +
 +
: WARNING: On Windows, ns_mktemp has the following behavior that may not be immediately obvious:
 +
:* multiple calls in the same thread return exact same name until a file is actually created with that name
 +
:* there are only 26 unique combinations per thread id for a given template
  
 
'''EXAMPLES'''
 
'''EXAMPLES'''

Latest revision as of 21:37, 3 October 2009

Man page: http://aolserver.com/docs/tcl/ns_mktemp.html


NAME

ns_mktemp - Make a unique temporary file name

SYNOPSIS

ns_mktemp template

DESCRIPTION

This command is a wrapper around the mktemp(3) function in the C standard library. It takes a template, which is a string whose last six characters must be XXXXXX, and returns a new string where those are replaced with random characters such as to make the string a unique file name. It is commonly used to safely create temporary files.
Note that some implementations of mktemp are not so safe - it creates predictable/only a small number of variations - please consult your system's man pages if this might be an issue to you. AOLserver could potentially be improved to use mkstemp instead.
WARNING: On Windows, ns_mktemp has the following behavior that may not be immediately obvious:
  • multiple calls in the same thread return exact same name until a file is actually created with that name
  • there are only 26 unique combinations per thread id for a given template

EXAMPLES

   % ns_mktemp /tmp/aol-XXXXXX
   /tmp/aol-rhaGGx

SEE ALSO


Category Documentation - Category Core Tcl API