in reply to How to eliminate text portion of a binary file?
Update: here is the example code:
P.s. In production code, checking the return values of syswrite would be prudent.my $buf=""; #append to buffer until headers are found and removed while (!($buf=~s/^.*?#### end_ascii_header\n//)) { sysread(INP,$buf,1024,length($buf)); } syswrite(OUT,$buf,$length($buf)); #copy the rest of the file while (sysread(INP,$buf,16384)) { syswrite(OUT,$buf,length($buf)); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to eliminate text portion of a binary file?
by Fletch (Bishop) on May 15, 2004 at 03:08 UTC | |
|
Re: Re: How to eliminate text portion of a binary file?
by Anonymous Monk on May 14, 2004 at 21:10 UTC |