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>tempnam</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
tempnam

Usage

   #include <stdio.h>
   char *tempnam(const char *dir, const char *prefix);

   ANSI

Description

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

   The tempnam is similar to tmpnam, except that the string to be returned
   is always malloc'ed. The dir argument is the directory in which to create
   the temporary file. The prefix argument is a 5 character prefix string
   which will be used for the start of the temporary filename.

Example 

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

   int main()
   {
       char *name;

       if ((name = tempnam(NULL,"abcde")) != NULL)
           printf("Temporary file %s created",name);
       else {

           printf("Unable to create temporary file");
           return EXIT_FAILURE;
       }
       return EXIT_SUCCESS;
   }

Return Value

   A malloc'ed string containing the temporary file name. If tempnam is
   unable to open the temporary file for any reason a NULL pointer is
   returned.

See Also

   tmpnam



See Also: tmpnam

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