mktemp(3C)
_________________________________________________________________
mktemp function
Return an unused temporary filename.
_________________________________________________________________
Calling Sequence
char *mktemp(), *char6, *result;
result = mktemp(char6);
where char6 is a pointer to a user-defined string at least
six characters long, not including the terminating
null byte.
Description
The mktemp function returns a complete, unused, temporary
filename. It replaces the last six characters of the input string
with the PID number and a unique sequence of alphabetic
characters.
Returns
The mktemp function returns the string pointer passed to it,
which now points to the temporary filename. If mktemp cannot
return a unique filename, it returns a null pointer.
Related Functions
See also the tmpfile and tmpnam functions.
Example
/* Program test for the mktemp() function. */
#include <stdio.h>
main() {
char name[12] = "FILE_ ";
printf("Temporary filename is: %s.\n", mktemp(name));
}
If the program is PID 57, the output might look like this:
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
mktemp(3C)
Temporary filename is: FILE_a00057.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)