MKTEMP(3) Library Functions Manual MKTEMP(3)

mktempmake a unique filename

#include <stdlib.h>

char *mktemp(char *template);

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.

The mktemp() function returns the pointer template . If a unique name cannot be created, template points to a null string.

No errors are defined.

None.

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, is preferred over this function.

None.

mkstemp(3) , tmpfile(3) , tmpnam(3) , <stdlib.h> .

February 1997 posix.fail