Constructs a unique filename. Format #include <stdlib.h> int mkstemp (char *template);
1 – Argument
template A pointer to a string that is replaced with a unique filename. The string in the template argument must be a filename with six trailing Xs.
2 – Description
The mkstemp function replaces the six trailing Xs of the string pointed to by template with a unique set of characters, and returns a file descriptor for the file open for reading and writing. The string pointed to by template should look like a filename with six trailing X's. The mkstemp function replaces each X with a character from the portable file-name character set, making sure not to duplicate an existing filename. If the string pointed to by template does not contain six trailing Xs, -1 is returned.
3 – Return Values
x An open file descriptor. -1 Indicates an error. (The string pointed to by template does not contain six trailing Xs.)