Patch byte in external file


Question

I'd like to patch byte in external file. How can I do that?

Answer

The following function can be used to solve the problem of patching:

Public Function PatchByte(ByVal vstrFilePath As String, _
                          ByVal vlngOffset As Long, _
                          ByVal vbytValue As Byte)
                          
    Dim intFn As Integer
    
    intFn = FreeFile
    Open vstrFilePath For Binary Access Write As #intFn
    Put #intFn, vlngOffset, vbytValue
    Close intFn
End Function

Copyright 1999-2008 by Shamil Salakhetdinov.  All rights reserved.