Opening files

Use the FreeFile function to get a file number, and then use an Open statement to open a file.

The syntax is:

fileNumber% = FreeFile Open fileName$ [ For {Input | Output | Append | Binary | Random }] [ Access {Read | Read Write | Write}] [ {Shared | Lock Read | Lock Read Write | Lock Write }]] As fileNumber% [ Len = recLen%]

[Charset = MIMECharsetName]

In the Open statement, you specify access mode and the read and/or write operation you intend to perform. If other processes or users have concurrent access to the file (over a network, for example), you can also specify how the file is to be shared.

For random access, you specify a record length (unless you are using the default of 128 bytes). To determine record length, you can use the Len or LenB function to return the length of the scalar variable or user-defined data type variable you are using to read and/or write records. To enhance performance during sequential access to a file, you can specify a buffer size for the read/write operations. You can also specify a character set to use for sequential access.