<< back to sysax.com Product page

5.1. Opening and closing local files

A file can be opened for reading or writing using the fileopen command. The predefined keywords read, write, and append are used to open the file for reading, writing, or appending. If the file is opened for writing, any existing file with the same name is deleted and a new file will be created. The name string specifies the name of the file to open. The fileresult predefined status flag is set to the predefined constant success if the command completed successfully.

The syntax is

Exhibit 5.1. table title

fileopen <keywords: read, write, append>, <name string>;

Some examples are

Exhibit 5.2. table title

fileopen write, "error.txt"; #create or open a new file for writing

fileopen append, "output.txt"; #open a file to append data to the end of the file

An opened file can be closed with the fileclose command. Since only one file can be opened at a time, no arguments are required.

The syntax is

Exhibit 5.3. table title

fileclose;

Some examples are

Exhibit 5.4. table title

fileclose; #close the file