写东西时无意间发现了一个有趣的问题:
Private Sub Command1_Click()
'写入,然后读取
Dim cells(10) As Byte
filenum = FreeFile
Open "c:\ceshi1.txt" For Binary As filenum
Put filenum, , "我"
Get filenum, , cells
MsgBox cells(0) '理论上应该是206才对 为什么会是0呢?
Close
End Sub
Private Sub Command3_Click()
'先写入,然后关闭 再重新打开读取
Dim cells(10) As Byte
filenum = FreeFile
Open "c:\ceshi2.txt" For Binary As filenum
Put filenum, , "我"
Close filenum
filenum = FreeFile
Open "c:\ceshi2.txt" For Binary As filenum
Get filenum, , cells
MsgBox cells(0) '正确
Close filenum
End Sub
Private Sub Command2_Click()
'写入,然后读取(读取时指定位置)
Dim cells(10) As Byte
filenum = FreeFile
Open "c:\ceshi3.txt" For Binary As filenum
Put filenum, , "我"
Get filenum, 1, cells
MsgBox cells(0) '正确
Close
End Sub
事实就是这样 谁能提供点官方的解释(我查过了MSDN,好像没说这个问题)
[此贴子已经被作者于2007-5-9 13:53:01编辑过]