.TH tmpnam() "" "" "STDIO Function (libc)"
.PC "Generate a unique name for a temporary file"
.B "#include <stdio.h>
\fBchar *tmpnam(\fIname\^\fB);\fR
\fBchar *\fIname\^\fB;\fR
.PP
.II "temporary file^generate name"
.II "file^generate name for temporary file"
.II "name^generate for temporary file"
.B tmpnam()
constructs a unique name for a file.
The names returned by
.B tmpnam()
generally are mechanical concatenations of letters, and therefore
are mostly used to name temporary files, which are never seen by the user.
A file named by
.B tmpnam()
does not automatically disappear when the program exits.
You must explicitly remove it before the program ends if you want it to
disappear.
.PP
.I name
points to the buffer into which
.B tmpnam()
writes the name it generates.
If
.I name
is set to NULL,
.B tmpnam()
writes the name into an internal buffer that may be overwritten
each time you call this function.
.PP
.B tmpnam()
returns a pointer to the temporary name.
Unlike the related function
.BR tempnam() ,
.B tmpnam()
assumes that the temporary file will be written into directory
.B /tmp
and builds the name accordingly.
.SH Example
For an example of this function, see
.BR execve() .
.SH "See Also"
.Xr "libc," libc
.Xr "mktemp()," mktemp
.Xr "tempnam()" tempnam
.br
\*(AS, \(sc7.9.4.4
.br
\*(PX Standard, \(sc8.1
.SH Notes
If you want the file name to be written into
.IR buffer ,
you should allocate at least
.B L_tmpnam
bytes of memory for it;
.B L_tmpnam
is defined in the header
.BR stdio.h .
Under \*(CO, it is 64 characters long.
