File Handling

HUNTER's Basic interpreter provides the user with the necessary commands and statements to communicate with the File Manager as follows

HUNTER's File Manager supports the use of sequential access files. Files are stored in HUNTER's RAM memory, but HUNTER'S Basic interpreter will treat them as it they were disk files for reading and writing.

File Numbers

When flies are OPENed for input or output they are assigned a 'file number' which is specified by the 'AS' parameter. The 'file number' cannot be greater than the value specified in MAXFILES. If no MAXFILES have been specified a default value of one is taken. A file is always referred to by its 'file number'.

File Handling Commands

A brief description of the file handling commands and statements follow, further details may be found in the relevant section of Basic Functions.


When files have been OPENed for reading or writing and no further access is required CLOSE will write the end of file marker (EOF) to the file.


When reading data from a file a check must always be made after every INPUT# statement for end of file, an attempt to read past the end of file will produce an error.


This command is used for reading data from a file.


Used for deleting files from within a Basic program. The file must first be CLOSEd if it has previously been OPENed for reading or writing.


This will return the number of records that have been read or written to a file. The parameter (n) refers to the 'file number' associated with the file.


Sets the maximum number of files that may be opened simultaneously; if it is not specified a default value of one is taken. MAXFILES will perform a CLEAR operation when it is executed, destroying all symbol table entries. Therefore it must be defined at an early point in the program.


This will re-name a file from within a Basic program.


Before a file can be read or written to it must first be OPENed. The OPEN command has as one of its parameters 'FOR' which has to be specified with one of three options which are:

OUTPUT = Opens and clears file ready for output.
APPEND = Opens a file for output. Records written are added to the end of the file.
INPUT = Opens a file for reading.


Data is output to the file. Each variable must be delimited by a comma.


Data is output to the file, variables do not need to be delimited by commas.