Expand|Select|Wrap|Line Numbers
- Public Sub ReWrite_Open_File(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_File mHandle
- End Sub