The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 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() function avoids this problem.

For portability with previous versions of this document, tmpnam() is preferred over this function.

 FUTURE DIRECTIONS

None.

 SEE ALSO

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

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]