MKTEMP(3) UNIX Programmer's Manual MKTEMP(3) NNAAMMEE mktemp - make a unique file name SSYYNNOOPPSSIISS cchhaarr **mmkktteemmpp((tteemmppllaattee)) cchhaarr **tteemmppllaattee;; mmkksstteemmpp((tteemmppllaattee)) cchhaarr **tteemmppllaattee;; DDEESSCCRRIIPPTTIIOONN _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. SSEEEE AALLSSOO access(2), getpid(2), open(2) DDIIAAGGNNOOSSTTIICCSS _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 7/9/88 April 10, 1987 1