FileOpen(1, "TESTFILE", OpenMode.Input)
' Close before reopening in another mode.
FileClose(1)
该示例以 Binary 模式打开该文件进行只写操作。
FileOpen(1, "TESTFILE", OpenMode.Binary,OpenAccess.Write)
' Close before reopening in another mode.
FileClose(1)
以下示例以 Random 模式打开该文件。该文件包含结构 Person 的记录。
Structure Person
<VBFixedString(30)> Dim Name As String
Dim ID As Integer
End Structure
' Count 30 for the string, plus 4 for the integer.
FileOpen(1, "TESTFILE", OpenMode.Random, , , 34)
' Close before reopening in another mode.
FileClose(1)
该代码实例以 Output 模式打开该文件;任何进程都可以读取或写入该文件。
FileOpen(1, "TESTFILE", OpenMode.Output, OpenShare.Shared)
' Close before reopening in another mode.
FileClose(1)
该代码实例以 Binary 模式打开该文件进行读取;其他进程无法读取该文件。