tmpnam
char *tmpnam (char fileName[]);
Purpose
Generates a string that is a valid filename and that is not the same as the name of an existing file. This function will generate a different string each time it is called, up to TMP_MAX times.
![]() |
Note You must use the remove function to remove such files when you no longer need them. You must remove the files before program execution terminates. |
Parameters
Output | ||
Name | Type | Description |
fileName | char [] | Contains the name of the file generated by the function. The name must point to an array of at least L_tmpnam characters. The value NULL also can be entered into this parameter, in which case the created name is left in an internal static buffer. |
Return Value
Name | Type | Description |
returnedFileName | char * | Contains a pointer to the filename generated by the function. If an error occurs, tmpnam returns NULL and sets errno to a nonzero value. |
Additional Information
Library: ANSI C Library
Include file: ansi_c.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later
Example
Refer to udp\DNSResolver.cws for an example of using the tmpnam function.