mktemp and mkstemp attempt to generate a file name that is not yet in use for any existing file. mkstemp creates the file and opens it for reading and writing; mktemp simply generates the file name.
You supply a simple pattern for the generated file name, as the string at path. The pattern should be a valid filename (including path information if you wish) ending with some number of `X' characters. The generated filename will match the leading part of the name you supply, with the trailing `X' characters replaced by some combination of digits and letters.
The alternate functions _mktemp_r and _mkstemp_r are reentrant versions. The extra argument reent is a pointer to a reentrancy structure.### Returns
mktemp returns the pointer path to the modified string representing an unused filename, unless it could not generate one, or the pattern you provided is not suitable for a filename; in that case, it returns NULL.
mkstemp returns a file descriptor to the newly created file, unless it could not generate an unused filename, or the pattern you provided is not suitable for a filename; in that case, it returns -1.
---
**Authoritative source**: BUSMASTER DITA help source `mktemp.dita`, compiled into `BUSMASTER.CHM` with the application.