我正在尝试将旧的Quick BASIC程序转换为VB.Net.似乎没有任何直接替换旧文件语句.建立一个数据库对我的简单需求来说似乎有些过分. 如何在VB.Net中执行以下操作? OPEN "test.dat" FOR RANDOM AS
如何在VB.Net中执行以下操作?
OPEN "test.dat" FOR RANDOM AS #1 LEN = 20 FIELD #1, 10 AS a$, 10 AS b$ LSET a$= "One" LSET b$= "Two" PUT #1, 1 GET #1, 1 PRINT a$, b$ CLOSE #1Microsoft.VisualBasic.FileOpen, FilePut和 FileGet语句应该是上述大多数代码的直接替代品.
Microsoft.VisualBasic.FileOpen(1, "test.dat", OpenMode.Random, OpenAccess.ReadWrite, OpenShare.Shared) Dim output As New Fields output.A = "One" output.B = "Two" Microsoft.VisualBasic.FilePut(1, output, 1) Dim input As New Fields Microsoft.VisualBasic.FileGet(1, input, 1) Debug.WriteLine("A = " & input.A & "; B = " & input.B) FileClose(1)