tmpnam

Generates a unique string for use as a valid temporary file name

Local Servers:blocking
Remote Servers:blocking
Classification:ANSI
Platform:NLM
Service:File System

Syntax

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

Parameters

buffer

(OUT) Points to the buffer to receive the generated temporary file name.

Return Values

If you pass a NULL pointer, tmpnam leaves the temporary file name in an internal static buffer and returns a pointer to that buffer.

Remarks

Be aware that the internal static buffer is modified every time tmpnam is called, whether or not you pass a NULL pointer. If you want to preserve the temporary file name currently stored in the internal static buffer, copy it to another buffer (by calling the strcpy function) before calling tmpnam again.

If you pass a pointer to your created array, tmpnam leaves the temporary file name in that array and returns a pointer to it. tmpnam simply returns the pointer you have supplied. It does no error checking to ensure that your array is big enough to accommodate the file name. The array should be at least L_tmpnam characters in length, where L_tmpnam is 13 characters (12 for the DOS 8.3 characters plus one for the NULL terminator).

See Using tmpnam: Example (NDK: Sample Code).

See Also

access