NAME
mktemp — make a
unique filename
SYNOPSIS
#include <stdlib.h> char *mktemp(char *template);
DESCRIPTION
The mktemp() function replaces the contents of the string pointed to by template by a unique filename and returns template . The application must initialise template to be a filename with six trailing 'X's; mktemp() replaces each 'X' with a single byte character from the portable filename character set.
RETURN VALUE
The mktemp() function returns the pointer template . If a unique name cannot be created, template points to a null string.
ERRORS
No errors are defined.
EXAMPLES
None.
APPLICATION USAGE
Between the time a pathname is created and the file opened, it is possible for some other process to create a file with the same name. The mkstemp(3) function avoids this problem.
For portability with previous versions of this document, tmpnam() is preferred over this function.
FUTURE DIRECTIONS
None.
SEE ALSO
mkstemp(3) , tmpfile(3) , tmpnam(3) , <stdlib.h> .