Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>tmpnam() generate a temporary file name</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 tmpnam()                Generate A Temporary File Name

 #include <stdio.h>

 char       *tmpnam(sptr);
 char       *sptr;

    tmpnam() generates a temporary file name. If 'sptr' is NULL, the file
    name is stored in an internal static object and a pointer to that
    object is returned.  If 'sptr' points to an array, the file name is
    stored in that array and a pointer to it is returned. The array
    should be of at least 'L_tmpnam' characters. 'L_tmpnam' is defined in
    <stdio.h> as:

          #define L_tmpnam 13      /*tmpnam buffer size*/

    A unique file name is generated each time tmpnam() is called. Up to
    TMP_MAX names can be generated. TMP_MAX is defined in <stdio.h> as
    65535.

       Returns:     A pointer to the name generated. If 'sptr' is NULL, a
                    pointer to an internal static object.

   -------------------------------- Example ---------------------------------

 The following statements generate and print out a temporary file name.

           #include <stdio.h>

           char *name;

           main()
           {
               if ((name = tmpnam(NULL)) != NULL)
                   printf("temp name generated: %s\n",name);
               else
                   printf("unable to generate name");
           }


See Also: creat() fopen() mktemp() open() tmpfile()

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