tmpnam(3C)
_________________________________________________________________
tmpnam function
Return a pointer to a temporary filename.
_________________________________________________________________
Calling Sequence
#include <stdio.h>
char *tmpnam(), *name, buffer[Ltmpnam];
name = tmpnam([buffer]);
or
name = tmpnam((char *)0);
where name receives the pointer to the temporary filename.
If the buffer was NULL or not specified, this will
point to an internal buffer that will be overwritten
with the next call to tmpnam.
buffer is a pointer to an array at least L_tmpnam
bytes long (L_tmpnam is defined in stdio.h) or a
NULL pointer. If a pointer that is not NULL is
passed, it is used instead of the internal buffer to
hold the temporary name.
Description
Use the tmpnam function to get a temporary filename. The tmpnam
function checks to see if the buffer argument exists. If there
is no argument, the function acts as if the user passed a NULL
pointer. To be compatible with UNIX implementations of tmpnam,
you must always pass an argument.
If the directory :TMP exists and you can create files in it, the
temporary filename is created there. Otherwise, the filename
points to the current directory.
Returns
The tmpnam function returns a pointer to the temporary filename.
Related Functions
See also the mktemp and tmpfile functions.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
tmpnam(3C)
Example
/* Program test for the tmpnam() function. */
#include <stdio.h>
main() {
char *tmpnam(), *name, buffer[L_tmpnam];
name = tmpnam(buffer);
printf("Here's a temporary filename:\n%s\n", name);
}
For a program with PID 13, the output is as follows:
Here's a temporary filename:
?0013.CFILE.0001.TMP
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)