The following code opens the file TESTFILE
in sequential-input mode.
Open
"TESTFILE"For Input
As
#
1 ' Close before reopening in another mode. Close #1
This example opens the file in Binary mode for writing operations only.
Open
"TESTFILE"For Binary Access Write As #
1 ' Close before reopening in another mode. Close #1
The following example opens the file in Random mode. The file contains records of the user-defined type Record
.
Type Record ' Define user-defined type. ID As Integer Name As String * 20 End Type Dim MyRecord As Record ' Declare variable.Open
"TESTFILE"For Random As #
1Len =
Len(MyRecord) ' Close before reopening in another mode. Close #1
This code example opens the file for sequential output; any process can read or write to file.
Open
"TESTFILE"For Output Shared As #
1 ' Close before reopening in another mode. Close #1
This code example opens the file in Binary mode for reading; other processes can't read file.
Open
"TESTFILE"For Binary Access Read Lock Read As #
1