Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>tmpnam</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
tmpnam

Usage

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

   ANSI

Description

   The tmpnam function generates a unique temporary file name that is both
   valid, and not the same as, the name of any existing file.

   The tmpnam function generates a different string each time it is called,
   up a to a maximum which is defined by the macro TMP_MAX, found in
   stdio.h. If tmpnam is called more than TMP_MAX times the generated names
   cannot be guaranteed to be unique. The argument passed to tmpnam can be
   either a pointer to a buffer, which should be large enough to hold the
   file name, or a NULL pointer.

Example 

   #include <stdio.h>
   #include <stdlib.h>

   int main()
   {
       char *name;

       if ((name = tmpnam(NULL)) != NULL)
           printf("Temporary file %s created",name);
       else {
           printf("Unable to create temporary file");
           return EXIT_FAILURE;
       }

       return EXIT_SUCCESS;
   }

Return Value

   If the argument passed to tmpnam is a pointer to a buffer, the temporary
   file name is placed in this buffer, and the return value is a pointer to
   this buffer. If the argument to tmpnam is a NULL pointer, the file name
   is placed in a static data area, overwritten at each call to tmpnam, and
   a pointer to this static data buffer is returned.





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