TEMPNAM
Section: Linux Programmer's Manual (3)
Updated: April 3, 1993
Index
Return to Main Contents
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 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().
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)
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUE
-
- ERRORS
-
- CONFORMING TO
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 12:25:30 GMT, March 22, 2025