Data Access Functions
Working with large amounts of data often requires that data be written to or read from a file. Before either operation can take place, however, the file must first be opened. The FileOpen Function lets you create and access files with one of three types of file access:
- Sequential access (Input, Output, and Append modes) is used for writing text files, such as error logs and reports.
- Random access (Random mode) is used to read and write data to a file without closing it. Random-access files keep data in records, which makes it easy to locate information quickly.
- Binary access (Binary mode) is used to read or write to any byte position in a file, such as storing or displaying a bitmap image.
Do not use the FileOpen function to manipulate files that are usually edited by a specific application, such as Microsoft Office documents or registry files. Doing so will cause file corruption and loss of file integrity.
The following table shows the statements typically used when writing data to and reading it from files.
|Access type||Writing data||Reading data|
|Sequential||Print, PrintLine Functions||InputString Function|
|Random||FilePut Function||FileGet Function|
|Binary||FilePut Function||FileGet Function|