20. Writing 4GL Statements : Accessing Files from 4GL : File Types
 
Share this page                  
File Types
A file can be opened as one of 3 types:
binary
A binary type file has fixed-length records and no newline markers. A binary file cannot be edited by the system editor. The record size can be specified when the file is opened. If the record size is not specified, the record size is determined from the first read or write. Each subsequent read or write (until the file is closed) must consist of records of the declared size. The record size is not stored when the file is closed and reopened.
text
A text type file can accept only string data types (char, varchar, c and text). A text file can be edited by the system editor if the file does not exceed the editor's line length or file size limits.
stream
A stream type file accepts any data in any order. The user must read the data in the same way it was written.
When you close and reopen a file, you must not change the type of the file. 4GL cannot read the data correctly if, for example, a file is created as a binary type and reopened as a text type file.