Dim fileNum As Integer
Dim fname As String
Dim customer As String, addr As String, city As String
fname = "data.dat"
fileNum% = Freefile()
Open fname for Output As fileNum%
Write #fileNum%, {John Roe
and family}, "25 Main Street", "Springfield, IL"
Write #fileNum%, "Mary Johnson", {Fifth Floor
55 Cambridge Parkway}, "Cambridge, MA"
閉じる
fileNum% = FreeFile()
Open fname For Input As fileNum%
For i% = 1 to 2
Input #fileNum%, customer, addr, city
Print customer
Print addr
Print city
Print ""
Next i%
' Output:
' Outputs two groups, each consisting of three String values,
' with some Strings on multiple lines:
' John Roe ' customer, line 1
' and family ' customer, line 2
' 25 Main Street ' addr
' Springfield, IL ' city
' Mary Johnson ' customer
' Fifth Floor ' addr, line 1
' 55 Cambridge Parkway ' addr, line 2
' Cambridge, MA ' city
Close fileNum%