1. Home
  2. %TEMPFILE directive

%TEMPFILE directive

Creates a unique temporary file in the Genstat temporary folder.

No options

Parameters

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

Description

%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:

%TEMPFILE PREFIX='Out'; FILENAME=TFile; INDEX=filenumber

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.
Parameter: PREFIXFILENAMEINDEX.

See also

Directives: CLOSEFDELETEOPEN.
Procedure: GETTEMPFOLDER.
Commands for: Program control.

Updated on February 7, 2023

Was this article helpful?