Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm looking for an elegant way to read in a binary file, and delete up to a certain byte pattern. For example, if I'm looking for
0x0D 0x0Awhat would be the best way to delete up to these bytes up to, but NOT including them?
Should I use `getc` to test each byte? Then if it is true, grab the offset. Then how would I delete to that offset (minus two bytes)? (I heard that `getc` was frowned down upon.)
Thanks for any pointers.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: Manipulating Binary files
by Ovid (Cardinal) on May 14, 2001 at 19:50 UTC | |
|
(tye)Re: Manipulating Binary files
by tye (Sage) on May 14, 2001 at 20:12 UTC | |
by Ovid (Cardinal) on May 14, 2001 at 20:16 UTC | |
by tye (Sage) on May 14, 2001 at 20:23 UTC | |
|
Re: Manipulating Binary files
by MeowChow (Vicar) on May 14, 2001 at 22:07 UTC | |
by tye (Sage) on May 14, 2001 at 22:09 UTC | |
by MeowChow (Vicar) on May 14, 2001 at 22:15 UTC |