Computer Science


TEMPNAM(3)          Linux Programmer's Manual          TEMPNAM(3)

NAME
       tempnam - create a name for a temporary file

SYNOPSIS
       #include <stdio.h>

       char *tempnam(const char *dir, const char *pfx);

DESCRIPTION
       The  tempnam() function generates a unique temporary file-
       name using up to five characters of  pfx,  if  it  is  not
       NULL.   The directory to place the file is searched for in
       the following order:-

              a)     The directory specified by  the  environment
                     variable TMPDIR, if it is writable.

              b)     The directory specified by the argument dir,
                     if it is not NULL.

              c)     The directory specified by P_tmpdir.

              d)     The directory /tmp.

       The storage for the filename is allocated by malloc(), and
       so can be free'd by the function free().

RETURN VALUE
       The  tempnam()  function  returns  a pointer to the unique
       temporary filename, or NULL if a unique filename cannot be
       generated.

ERRORS
       EEXIST Unable to generate a unique filename.

CONFORMING TO
       SVID 3, BSD 4.3

SEE ALSO
       mktemp(3), mkstemp(3), tmpnam(3), tmpfile(3)

GNU                       April 3, 1993                         1

Back to the index


Apply now!


Handbook

Postgraduate study options

Computer Science Blog



Please give us your feedback or ask us a question

This message is...


My feedback or question is...


My email address is...

(Only if you need a reply)

A to Z Directory | Site map | Accessibility | Copyright | Privacy | Disclaimer | Feedback on this page