INtime SDK Help
tmpnam

Creates a temporary filename, which can open a temporary file without overwriting an existing file.

#include <stdio.h>
char *tmpnam (char *string);
errno_t tmpnam_s (char *string, rsize_t size);

Parameters

string
Pointer to the temporary filename.
size
maximum number of characters the function is allowed to write (typically the size of filename).

Remarks

If string is a null pointer, tmpnam leaves the result in an internal static buffer. Thus any subsequent calls destroy this value.

If string is not a null pointer, it is assumed to reference a string buffer of at least L_tmpnam bytes. The function will generate unique filenames for up to TMP_MAX calls.

The character string that tmpnam creates consists of the path prefix, defined by P_tmpdir, followed by a sequence consisting of the digit characters 0 through 9; the numerical value of this string can range from 1 to 65,535.

Changing the definitions of L_tmpnam or P_tmpdir in STDIO.H does not change the operation of tmpnam.

Return Values

A pointer to the temporary filename generated.
Success.
A null pointer if it is impossible to create the name or the name is not unique.
Failure.

tmpnam_s returns zero and writes the file name to string on success. On error, returns non-zero and writes the null character to string[0] (only if filename is not null and size is not zero and is not greater than RSIZE_MAX).

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/stdio.h stdio.h clib.lib

See Also

mktemp, tmpfile