tmpnam

Syntax

char *tmpnam(char *s)

Arguments

s
A pointer to a string where the filename will be stored. If s is NULL, the parameter is ignored.

Return

A pointer to a temporary/internal string buffer containing the temporary filename. Note that this string will be modified by further calls to tmpnam, so it should be regarded as a single use return value.

Description

Generates a guaranteed unique filename that can be used to create a temporary file.

Comment

Note that the generated filename will contain directory path characters, ie it may be preceded by a backslash on Windows machines.

Example

printf("A possible temporary filename: %s", tmpnam(NULL));

See Also

fopen, fclose, tmpfile