GetTempFileName (Generate a temporary file)

Top  Previous  Next


GETTEMPFILENAME( prefix, <pathname> )


Returns the name of a temporary file


A string constant or variable naming the prefix (first three letters) of the temporary file. If blank, the default prefix used is ‘$$$’


A string constant or variable naming the location of the temporary file. If omitted, the system TEMP or TMP directory path is used.

GETTEMPFILENAME is used to generate a temporary file. If the pathname specified is invalid, GETTEMPFILENAME returns an empty string.

Make sure to remove your temporary files that you create after use. The Windows system will not automatically remove these files.

To add support for this utility to your existing applications, you need only include the CWUTIL.INC file in the Global Map section of your program:


Return Data Type:     STRING


!Note ## represents a random number assigned to the temporary file name

   message(GETTEMPFILENAME('bob','d:\help'))   !created 'bob##.tmp' in D:\help

   message(GETTEMPFILENAME(''))                !created '$$$##.tmp' in

                                               !C:\WINNT\TEMP (my TEMP path)