COHERENT manpages

This page displays the COHERENT manpage for tmpnam() [Generate a unique name for a temporary file].

List of available manpages
Index


tmpnam() -- STDIO Function (libc)

Generate a unique name for a temporary file
#include <stdio.h>
char *tmpnam(name);
char *name;

tmpnam()  constructs a  unique  name for  a  file.  The  names returned  by
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 tmpnam()  does not automatically disappear when the program
exits.  You must  explicitly remove it before the program  ends if you want
it to disappear.

name points to the buffer into which tmpnam() writes the name it generates.
If name  is set to NULL,  tmpnam() writes the name  into an internal buffer
that may be overwritten each time you call this function.

tmpnam()  returns a  pointer  to the  temporary name.   Unlike the  related
function  tempnam(),  tmpnam()  assumes that  the  temporary  file will  be
written into directory /tmp and builds the name accordingly.

Example

For an example of this function, see execve().

See Also

libc,
mktemp(),
tempnam()
ANSI Standard, §7.9.4.4
POSIX Standard, §8.1

Notes

If you want the file name to be written into buffer, you should allocate at
least L_tmpnam  bytes of memory for  it; L_tmpnam is defined  in the header
stdio.h. Under COHERENT, it is 64 characters long.