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

Re: [MacPerl] newbie question: binary file manipulation



At 9:27 AM -0600 8/12/99, Douglas P. McNutt wrote:

>
>I think the "pack" suggestions of others will put out 8 byte doubles.


Read the documentation.  It's right there on your machine.

>
>I also think you should think about what you're trying to do. The 
>file in IEEE singles will be quite machine specific because of byte 
>ordering. It may also be less efficient in storage unless your 
>coordinates really have a spectacular range of values.


IEEE is, actually, widely portable.  I've moved binary data files 
between SPARC, PA-RISC, 68k and PPC, all big endian, with absolutely 
no problems.  I've never had need to use an Intel CPU, so I don't 
know if its bizarre endianess would cause trouble.

>
>Fixed point binary unsigned chars would be enough to save what you 
>show above. Even three byte ASCII with the decimal suppressed would 
>be smaller and more transportable than the floats. 16 bit integers 
>are another option but would also introduce the byte ordering 
>problem.
>
>Why floats?


It's a lot faster doing I/O using binary files.  It takes time for 
the machine to render/derender text.  Binary can just be plopped 
right into memory.


-----
Paul J. Schinder
schinder@pobox.com


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