[CODE=vb]Public Sub ReWrite_Open_Fi le(ByVal FileNo As Long)
Dim FileSize As Long, Buffer() As Byte
' PART 1: Read the file.
FileSize = LOF(FileNo) ' Determine how large the file is (in bytes).
ReDim Buffer(1 To FileSize) ' Set our buffer to that length.
Get #FileNo, 1, Buffer() ' Grab the entire file's data into the array
' PART 2
' If you plan to change the data, this is where it would happen.
'Beep
' PART 3: Write the file back.
If MsgBox("Write data back to the file?", vbYesNo) = vbYes Then
Put #FileNo, 1, Buffer() ' Write the data back to the file.
End If
End Sub
Private Sub command2_click( )
Dim mHandle
Open "a:\bonding.bin " For Binary Access Read Write Lock Write As mHandle
ReWrite_Open_Fi le mHandle
End Sub[/CODE]this code give error bad file name or number.Why it give such error.when i put the break point and find out where the error the occur it occur in the line 1.
Dim FileSize As Long, Buffer() As Byte
' PART 1: Read the file.
FileSize = LOF(FileNo) ' Determine how large the file is (in bytes).
ReDim Buffer(1 To FileSize) ' Set our buffer to that length.
Get #FileNo, 1, Buffer() ' Grab the entire file's data into the array
' PART 2
' If you plan to change the data, this is where it would happen.
'Beep
' PART 3: Write the file back.
If MsgBox("Write data back to the file?", vbYesNo) = vbYes Then
Put #FileNo, 1, Buffer() ' Write the data back to the file.
End If
End Sub
Private Sub command2_click( )
Dim mHandle
Open "a:\bonding.bin " For Binary Access Read Write Lock Write As mHandle
ReWrite_Open_Fi le mHandle
End Sub[/CODE]this code give error bad file name or number.Why it give such error.when i put the break point and find out where the error the occur it occur in the line 1.
Comment