From: Shankar Unni <shankar@powertelglobal.com>
Subject: Re: DEC / SGI binary files.
Date: 1997/11/03 [thread overview]
Message-ID: <345E2611.64CE5828@powertelglobal.com> (raw)
In-Reply-To: 63c8uj$63t@rzunews.unizh.ch
Serge Pachkovsky wrote:
> Anne-Gael Inisan (inisan@afmb.cnrs-mrs.fr) wrote:
> : This program creates a binary file, and my problem is that those two binary
> : files (created one on SGI, the other on DEC) differ:
I assume you mean binary data files created by your program..
> Try compiling your DEC executable with -convert big_endian.
>
> Generally, you should *never* expect binary files to be compatible between
> different machines (and even between different compilers on the same OS) -
> unless you go to the (quite considerable) effort of designing your files
> to be portable in the first place.
Even using "-convert big_endian" may not always help.
Binary data layouts vary between different architectures, even, for
instance, between Sparc and MIPS (both of which have very similar 32-bit
big-endian layout policies).
There is only one way to share binary data between heterogenous
machines: you have to use a common data format.
Typically, you'd format the data into some ASCII (or ISO) form. E.g.
you'd write out the number 10 as the ASCII characters "1" and "0". You'd
have to have routines to write out and read back structures
appropriately.
Another way would be to convert the data to some common external binary
representation (like XDR) - see the man pages for the XDR libraries for
details.
--
Shankar Unni Powertel Global, Inc.
(650) 259-1700 shankar@powertelglobal.com
(650) 259-1702 (fax) shankar@webnexus.com
next prev parent reply other threads:[~1997-11-03 5:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-10-31 5:00 DEC / SGI binary files Anne-Gael Inisan
1997-10-31 5:00 ` Serge Pachkovsky
1997-10-31 5:00 ` Anne-Gael Inisan
1997-11-03 5:00 ` Shankar Unni [this message]
1997-10-31 5:00 ` Dirk Bartz
1997-11-04 5:00 ` Michael Maxie
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox