1. Home
  2. %TEMPFILE directive

%TEMPFILE directive

Creates a unique temporary file in the Genstat temporary folder.

No options


PREFIX = string
Prefix for the filename
FILENAME = text Saves the filename
INDEX = scalar Saves the index number that follows the prefix in the filename


%TEMPFILE creates a unique file in the Genstat temporary folder. The location of the temporary folder can be obtained by the GETTEMPFOLDER procedure, and is set by the %TMP% or %TEMP% environment variables on your computer. An empty file is created, so that other programs will not use the same name.

The PREFIX parameter provides the text to be used at the start of the filename. The extension of the filename is always .tmp. The unique filename is returned by the FILENAME parameter, and the INDEX parameter saves its index number. Note, the filename has the index value written in hexadecimal format, but the index is saved as an ordinary number. For example:


could return TFile as 'C:/Temp/Genstat/Out1F.tmp' and INDEX as 31 (31 in hexadecimal = 1F).

The file is not deleted automatically at the end of the Genstat run. So, when you have finished using it, you need to delete it yourself (for example, with the FDELETE directive).

Options: none.

See also

Commands for: Input and output.

Updated on February 11, 2022

Was this article helpful?