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

Re: [MacPerl] Binary Files with ASCII headers



At 11.36 -0400 1999.06.04, Janine Ladick wrote:
>Arved Sandstrom wrote:
>
>> For each data file, open it for read, and open two others for write. Read
>> in the first 256 bytes, and write it to output file #1. You're now
>> positioned at the start of the binary (8-bit ASCII), which you then write
>> to output file #2.
>
>I do this kind of thing at work with dBASE files.  My scripts are
>written in Win32 Perl, but the same process should work for you.
>
>For each input file, open with filehandle HANDLE.  Then:
>
>binmode(HANDLE);    # process HANDLE as a binary file
>seek(HANDLE,0,0);     # make sure you're at the beginning of the file
>
>After that, you can write the first 256 bytes to file #1 and the rest
>of the data to file #2, as suggested above.

Note that binmode() is completely unnecessary on MacPerl (though it doesn't
hurt anything, either).

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org