Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdio.h>
    char *tmpnam( char *buffer );

Description:
    The  tmpnam function generates a unique string for use as a valid file
    name.  An internal static buffer is used to construct the filename.
     Subsequent calls to tmpnam reuse the internal buffer.

Returns:
    If the argument buffer is a NULL pointer, tmpnam returns a pointer to an
    internal buffer containing the temporary file name.  If the argument
    buffer is not a NULL pointer, tmpnam copies the temporary file name from
    the internal buffer to the specified buffer and returns a pointer to the
    specified buffer.  It is assumed that the specified buffer is an array
    of at least  L_tmpnam characters.

    If the argument buffer is a NULL pointer, you may wish to duplicate the
    resulting string since subsequent calls to tmpnam reuse the internal
    buffer.


         char *name1, *name2;

         name1 = strdup( tmpnam( NULL ) );
         name2 = strdup( tmpnam( NULL ) );


See Also:
    tmpfile

Example:
    #include <stdio.h>

    void main()
      {
        char filename[ L_tmpnam ];
        FILE *fp;

        tmpnam( filename );
        fp = fopen( filename, "w+b" );
        /* . */
        /* . */
        /* . */
        fclose( fp );
        remove( filename );
      }

Classification:
    ANSI

Systems:
    All

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson