7.19.4.4 The tmpnam function

Synopsis

1

#include <stdio.h>
char *tmpnam(char *s);

Description

2

The tmpnam function generates a string that is a valid file name and that is not the same as the name of an existing file.[1] The function is potentially capable of generating TMP_MAX different strings, but any or all of them may already be in use by existing files and thus not be suitable return values.

3

The tmpnam function generates a different string each time it is called.

4

The implementation shall behave as if no library function calls the tmpnam function.

Returns

5

If no suitable string can be generated, the tmpnam function returns a null pointer. Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an internal static object and returns a pointer to that object (subsequent calls to the tmpnam function may modify the same object). If the argument is not a null pointer, it is assumed to point to an array of at least L_tmpnam chars; the tmpnam function writes its result in that array and returns the argument as its value.

Environmental limits

6

The value of the macro TMP_MAX shall be at least 25.

Footnotes