File Modes
The following table lists the values you can specify
for the Mode argument.
Mode |
Description |
Append |
Opens the file
for sequential output, beginning at the end
of the file if the file exists. If the file
doesn't exist, VB creates the file. |
Binary |
In Binary mode,
you can access a file at the byte level. |
Input |
Opens the file
for sequential input, starting at the beginning
of the file. Data is read in the same order
it was sent to the file. |
Output |
Opens the file
for sequential output, starting at the beginning
of the file. If the file doesn't exist, VB creates
the file; otherwise, VB overwrites the file. |
Random |
Opens the file
for random read and write access. The data can
be read from or written to any specific record
boundary. |
Restricting Access
The optional AccessRestriction argument specifies
the operations permitted on the open file: Read, Write,
or Read Write.
Locking the File
Use a LockType argument value to specify the operations
permitted on the open file by other processes. This
parameter is useful when writing network applications.
You can restrict access to a file so that only one
user at a time has access to the file or can write
to the file. The valid options for this argument are:
Shared, Lock Read, Lock Write, and Lock Read Write.
Record Length
For files opened for random access, this value is
the record length. For sequential files, this value
is the number of characters buffered. This argument
is necessary when accessing records from a file. The
first record in a file begins at location 1, and all
subsequent records are written at locations in increments
of 1. The actual location in the file of any given
record is N X intRecordLength, where N is the record
number.
A record is one logical line from a file that
holds a complete set of data. |
|