Open File

Opens a file


fileId = Open File (fileName,writeAccess,type,format)


This command opens the specifed file and returns the file identifier in fileId. If for any reason the command could not open the file then it causes an error.

fileName is a string containing the full path of the file to open. This path is referenced from the current directory. For more information about this see the command Set Directory.

writeAccess is a boolean which specifies whether or not you want to be able to write to the file. If you pass true then you will be permitted to write to the file, if you pass false then you will only be allowed to read from the file.

type is a 4 character string containing the type of the file you wish to open. If an attempt is made to open a file with a different type then this command will cause an error.

format is a string containing the data format of the file you wish to create. TNT Basic currently supports two types of files...

Data File - "Data"
Data is stored in TNT Basic's own format. These file use less space and a quicker to access, however, they cannot be easily made by hand.

Text File - "Text"
Data is stored as a series of lines in a text file. This takes up more space and is slightly slower to access but the advantage is that they are easy to create by hand.

If this field is left blank then it defaults to a data file.

Table of contents