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

HOME    TOPICS

Copyright © 1998–1999 by Shamil Salakhetdinov.
All rights reserved. Terms of use.

Last updated: June 7, 1999

Published also here at 4TOPS: Patch byte in external file