FileCreateTemp

Creates a temporary file.

Syntax:

FileCreateTemp ( prefix )

Parameters:

(s) prefix specifies a prefix for the file name, up to 3 characters long (the string may be longer than that, but only the first 3 characters are used).

Returns:

(s) full path name full path name of the temporary file created.

 

This function creates a 0-byte file with a unique name, in the directory designated for temporary files (as specified by the "TMP" or "TEMP" environment variable).

 

The temporary file name will have the form:

preXXXX.tmp

 

Where "pre" is the prefix specified by the user, and "XXXX" is a 4-character hexadecimal string generated to guarantee a unique file name. The file name will have an extension of ".tmp".

Note: This file will not be automatically deleted by the system. See the function FileDelete to delete this file.

Example:


tempfile = FileCreateTemp("TMP")
filehandle = FileOpen(tempfile,"WRITE")
FileWrite(filehandle,"Temporary stuff")
FileClose(filehandle)
Message(tempfile,"Temp file created")
FileDelete(tempfile)
Message(tempfile,"Temp file deleted")
Exit
See Also:

FileDelete, FileOpen