Navigation: Advanced Topics > Clarion Language Utilities >====== GetTempFileName (Generate a temporary file) ====== | |
GETTEMPFILENAME( prefix, <;pathname> )
GETTEMPFILENAME | Returns the name of a temporary file |
prefix | A string constant or variable naming the prefix (first three letters) of the temporary file. If blank, the default prefix used is '$$$' |
pathname | 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:
INCLUDE('CWUTIL.INC'),ONCE
Return Data Type: STRING
Example:
!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)