Page 1 of 1

How to modify bytes in a binary file with RunRev

Posted: Sat Jan 23, 2010 7:22 pm
by titobal
Hi all,

I would like to know if it is possible to modify bytes from a binary file using runrev ?

What I want to do for example is ... I load a binary file (which is a pure binary files filled with bytes),

then once loaded into a buffer I want to modify the 4th byte (offset $4) from the value it currently has (let say $80) into another value (let say $81 hex value)

then save this buffer into a new binary file...

How would you achieve that ?

Any help is greatly appreciated.

Thanks.

Re: How to modify bytes in a binary file with RunRev

Posted: Sun Jan 24, 2010 3:28 am
by RRobert
Hello,
I would like to know if it is possible to modify bytes from a binary file using runrev ?
Sure.
How would you achieve that ?
Load the file into a buffer, convert each character to a the hex value by using the baseConvert function. Make your changes and write the file back.

Robert

Re: How to modify bytes in a binary file with RunRev

Posted: Sun Jan 24, 2010 5:56 pm
by titobal
Thanks rrobert,

could you provide couple sample code to do that ? I am really novice in runrev ;-)

TIA.

Re: How to modify bytes in a binary file with RunRev

Posted: Sun Jan 24, 2010 6:43 pm
by BvG
you can also use the binarencode and binarydecode stuff, but if you're just beginning with rev, i suggest to try something else then binary stuff first.