LOTUSSCRIPT LANGUAGE


Binary files
Binary files are designed to provide the most control over the organization of your data for both reading and writing. However, you must know exactly how the file was written.

Opening binary files

The syntax is:

Open fileName For Binary As fileNumber

Record-length arguments are ignored.

If the file does not exist, it is created, regardless of the access type supplied to the Open statement.

Using variable-length fields

Binary files can hold variable-length records. Since you need to know the string sizes to read them, you should assign a length field to each variable-length record (each string). This is not necessary if the string is a component of a user-defined type; in this case, LotusScript automatically assigns one.

Binary access provides a byte-by-byte view of a file. A file appears to be a continuous stream of bytes, which may or may not be alphanumeric characters.

Writing to binary files

To write to a binary file, use this Put statement:

Put fileNumber, bytePosition, variableName

Here, the bytePosition parameter is the position in the file at which to start writing. The first byte in a file is at position 1; position zero is illegal, and results in an error.

Reading from binary files

To read data from a binary file, use the following:


See Also