mktemp [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
mktemp
Creates a unique file name.
Syntax
char *mktemp (char *template)
Parameters
template A character pointer to a string containing a template file
name having six trailing Xs.
Return Values
x A pointer to template, or to a null string if it runs out
of letters.
Description
The mktemp function replaces the contents of the string pointed to by
template with a unique file name, and returns the address of template.
This function replaces the Xs in template with a letter and a number.
The letter is chosen so that the resulting name does not duplicate the
name of an existing file. If there are fewer than 6 Xs in template, the
letter is dropped first, and then high-order digits of the process ID are
dropped.
The mktemp function returns the unique file name in template. Therefore,
you must refresh the template for every unique file you want to open. If
mktemp runs out of letters, it returns a pointer to the empty string "".
mktemp does not check to see if the file name part of template exceeds
the maximum length of a file name.
See Also
getpid(), open(), tmpfile(), tmpnam()
MPE/iX 5.0 Documentation