

tempnam()                General Function               tempnam()




Generate a unique name for a temporary file

cchhaarr *tteemmppnnaamm(_d_i_r_e_c_t_o_r_y, _n_a_m_e);
cchhaarr *_d_i_r_e_c_t_o_r_y, *_n_a_m_e;

tempnam constructs  a unique temporary  name that can  be used to
name a file.

directory points  to the name of the directory  in which you want
the temporary  file written.  If  this variable is  NULL, tempnam
reads the  environmental variable TMPDIR  and uses it  for direc-
tory.   If neither  directory nor TMPDIR  is given,  tempnam uses
/tmp.

name points  to the string  of letters that will  prefix the tem-
porary name.   This string should not be more  than three or four
characters,  to prevent  truncation or  duplication  of temporary
file names.  If name is NULL, tempnam sets it to t.

tempnam uses  malloc to allocate a buffer  for the temporary file
name it returns.   If all goes well, it returns  a pointer to the
temporary name it has written.  Otherwise, it returns NULL if the
allocation fails or if it cannot build a temporary file name suc-
cessfully.

***** See Also *****

general functions, mktemp(), tmpnam()

***** Notes *****

tempnam is not described in the ANSI Standard.  Programs that use
it will  not conform strictly the Standard, and  may not be port-
able to other compilers or environments.






















COHERENT Lexicon                                           Page 1


