Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C - <b>tempnam() generate a temporary file name in given directory</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
tempnam()                Generate a Temporary File Name in Given Directory

 #include   <stdio.h>

 char       *tempnam(dir,prefix);
 char       *dir;
 char       *prefix;

    tempnam() creates a temporary file in another directory.  'prefix' is
    the prefix to the file name.  tempnam() looks for the file name in
    the following directories (in order of precedence):

                 Condition                           Directory Used

            TMP environment variable is set        Directory specified by TMP
            and directory specified by TMP
            exists.

            TMP environment variable not set,      The 'dir' argument to
            or directory specified by by TMP       tempnam()
            does not exist.

            The 'dir' argument in NULL, or         P_tmpdir in stdio.h
            'dir' is name of nonexistent
            directory.

            P_tmpdir does not exist.               \tmp

    Returns:    A pointer to the name generated.  A NULL value is
                returned if the name cannot be created or it already
                exists.

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

    The following statements create a temporary file name to be used as a
    file in another directory.

         #include <stdio.h>

         char *tname;

         main()
         {
             if ((tname = tempnam("c:\test","std")) != NULL)
                   printf("temp file : %s\n",tname);
             else
                   printf("can't make temp file\n");
         }

See Also: mktemp() tmpfile()

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