Open

<< Click to Display Table of Contents >>

Navigation:  File functions and statements >

Open

Description

Enables input/output (I/O) to a file.

Syntax

Open pathname For mode As [#]filenumber [Len=reclength]

 

The Open statement syntax has these parts:

 

Part

Type

Description

Pathname

String

Required. String expression that specifies a file name - may include directory or folder, and drive.

Mode


Required. Keyword specifying the file mode: Append, Binary, Input, Output, or Random. If unspecified, the file is opened for Random access.

Filenumber

Integer

Required. A valid file number in the range 1 to10, inclusive. Use the FreeFile function to obtain the next available file number.

Reclength

Integer

Optional. Number less than or equal to 32,767 (bytes). For files opened for random access, this value is the record length. For sequential files, this value is the number of characters buffered.

Remarks

You must open a file before any I/O operation can be performed on it. Open allocates a buffer for I/O to the file and determines the mode of access to use with the buffer.