Results 1 to 2 of 2

Thread: Simple Hex edit

  1. #1

    Thread Starter
    Addicted Member DanCool999's Avatar
    Join Date
    Jul 2006
    Posts
    141

    Simple Hex edit

    I am wondering if there a simple way to change 1 character of a file. Is there a simple program with command prompt that can be executed. I don't really want to open, load, and resave as it is a 30mb file.

    Thanks.
    Dan " "

    Visual Basic Professional 6.0

  2. #2
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Simple Hex edit

    As you wish to replace part of a file for something the same size the whole file does not have to be loaded.

    If you know the position of this byte/char it's even easier. Any old Hex editor should do or a little bit of code...
    Code:
    Dim FF as Integer, BytPos as Long, NewChar as byte
    FF = freefile
    BytPos = 123456 'or whatever
    NewChar = Asc("x") 'or whatever
        If Lenb(filename) <> 0 Then
            'On error resume next 'comment out for debugging
            Open filename for binary as #FF
            If LOF(ff) >= BytPos then Put #ff,BytPos,NewChar
            Close #ff
            'On error goto 0
        end if
    I'm without IDE so the above might want tweaking

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width