From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,e8fe98423fef13f5 X-Google-Attributes: gidfee84,public X-Google-Thread: f8eb4,e8fe98423fef13f5 X-Google-Attributes: gidf8eb4,public From: Shankar Unni Subject: Re: DEC / SGI binary files. Date: 1997/11/03 Message-ID: <345E2611.64CE5828@powertelglobal.com>#1/1 X-Deja-AN: 286812141 References: <3459A234.CC3EDE4F@afmb.cnrs-mrs.fr> <63c8uj$63t@rzunews.unizh.ch> X-Trace: 878585502 27001 (none) 206.86.0.12 Organization: Powertel Global, Inc. Newsgroups: comp.unix.osf.osf1,comp.sys.sgi.apps 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