2.11BSD/man/cat3/mkstemp.0

Compare this file to the similar file:
Show the results in this format:




MKTEMP(3)	    UNIX Programmer's Manual		MKTEMP(3)



NAME
     mktemp - make a unique file name

SYNOPSIS
     char *mktemp(template)
     char *template;

     mkstemp(template)
     char *template;

DESCRIPTION
     _M_k_t_e_m_p creates a unique file name and returns the address of
     the template.  The template should contain a file name with
     trailing _X's, normally something like /_t_m_p/_t_e_m_p_X_X_X_X_X_X.  The
     _X's are replaced by the current process number and/or a
     unique letter combination.  _M_k_s_t_e_m_p makes the same replace-
     ment to the template but opens the template file and returns
     a file descriptor open for reading and writing.  _M_k_s_t_e_m_p
     avoids the race between testing whether the file exists and
     opening it for use.  The number of file name combinations
     _m_k_t_e_m_p and _m_k_s_t_e_m_p will try depends on the number of _X's
     placed on the end of the template; six _X's will result in
     them trying roughly 26 ** 6 combinations.

SEE ALSO
     access(2), getpid(2), open(2)

DIAGNOSTICS
     _M_k_t_e_m_p returns NULL on failure, _m_k_s_t_e_m_p returns -1 if no
     suitable file could be created.

























Printed 11/26/99	 April 10, 1987                         1