[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to modify string in binary files ?



Hello Chris !

Chris Jones wrote:
On Mon, Aug 31, 2009 at 08:08:50PM EDT, Jerome BENOIT wrote:
Hello List,

I would like to change the string of a file name in a (propriety) binary:
if applicable, how can we do that ?

Use vim's binary mode.
$ vim -b binary-file

And before you start editing:

:h edit-binary

I have just tried.

It is claimed that

 When editing executable files the number of characters must not change.
 Use only the "R" or "r" command to change text.  Do not delete characters
 with "x" or by backspacing.

So a string cannot be made longer.
Can we make a string shorter ?
The first idea that comes is to put a '\n' at the desired end of the string
and then fill the extra with '\0': is it safe.
Otherwise, as no HEX code appears, is `bvi' a good alternative ?

Jerome


CJ



--
Jerome BENOIT
jgmbenoit_at_mailsnare_dot_net


Reply to: