GNU/Linux |
RedHat 5.2(Apollo) |
|
![]() |
tempnam(3) |
![]() |
tempnam − create a name for a temporary file
#include <stdio.h>
char *tempnam(const char *dir, const char *pfx);
The tempnam() function generates a unique temporary filename 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().
The tempnam() function returns a pointer to the unique temporary filename, or NULL if a unique filename cannot be generated.
EEXIST |
Unable to generate a unique filename. |
SVID 3, BSD 4.3
mktemp(3), mkstemp(3), tmpnam(3), tmpfile(3)
![]() |
tempnam(3) | ![]() |