Name
GetTempFileName -- return name for a temporary file (V3.0)
Synopsis
f$ = GetTempFileName()
Function
This function can be used to obtain a file that you can use temporarily. This is useful in case you temporarily need to store some information in a file which you will delete later. Hollywood will delete all temporary files automatically when it terminates but you can also do that manually using DeleteFile().

It is preferable to use this function if you need to work with temporary files because each operating system stores its temporary files in a different place. By using this function you can be sure that your temporary files end up in the correct folder.

Please note that this function will not only return a file name but it will also create an empty file for you. This is done to avoid any possible race conditions with other applications which might want to store their own temporary file under the very same name. This is not possible if the file already exists so this is why GetTempFileName() will create an empty file for you.

Inputs
none

Results
f$
file name that you can use for temporary operations
Example
f$ = GetTempFileName()
OpenFile(1, f$, #MODE_WRITE)
WriteLine(1, "My temporary file")
CloseFile(1)
The code above will obtain the name of a temporary file and then write some text into it. The file will be automatically deleted when Hollywood terminates.

Show TOC