VB二进制文件读写

数组存取
 

存数组
Private Sub Command2_Click()
Dim fileNumber As Integer
Dim S9 As String
Dim k As Integer
Dim l As Integer
 
On Error Resume Next
fileNumber = FreeFile()
 
S9 = "D:\zs.txt"
 
If Dir(S9) <> "" Then Kill S9
Open S9 For Binary As #fileNumber
k = UBound(arr)
Put #fileNumber, , k
Put #fileNumber, , arr
l = UBound(azz)
Put #fileNumber, , l
Put #fileNumber, , azz
Close #fileNumber
 
End Sub

读数组
Private Sub Command3_Click()
Dim fileNumber As Integer
Dim S9 As String
Dim k As Integer
Dim l As Integer
 
 
Dim ayy() As Integer
Dim akk() As Integer
 
On Error Resume Next
fileNumber = FreeFile()
 
S9 = "D:\zs.ini"
 
Open S9 For Binary As #fileNumber
Get #fileNumber, , k
ReDim ayy(k)
Get #fileNumber, , ayy
 
Get #fileNumber, , l
ReDim akk(l)
Get #fileNumber, , akk
 
Close #fileNumber
 
End Sub
 
 
结构体读写
 
 
posted @ 2016-01-21 16:56  SharpCJ  阅读(1790)  评论(0编辑  收藏  举报