Editing a hex file?
- Posted by tonysteward May 27, 2013
- 1267 views
I have a bin file which is a hex dump from an eeprom. Please see image https://dl.dropboxusercontent.com/u/8952255/ScreenClip.png
I want to replace the highlighted characters with 6 digits entered into a text box. So if a users enters 323453 for example then these character must be in the highlighted section. File size and location will never change.
Here is how I have read the file but i'm not sure how to replace the parts of the file I want.
integer fn integer len integer test sequence tt atom aa fn = open("Lagard.bin", "rb") -- an existing file sequence whole_file whole_file = {} sequence chunk while 1 do chunk = get_bytes(fn, 16) -- read 100 bytes at a time whole_file &= chunk -- chunk might be empty, that's ok if length(chunk) < 16 then exit end if end while close(fn)