Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!agate!agate!adrianho From: adrianho@barkley.berkeley.edu (Adrian J Ho) Newsgroups: comp.unix.questions Subject: Re: Binary File Compatibility Between ULTRIX and Other UNIX Systems Message-ID: Date: 6 Apr 91 02:06:57 GMT References: <26467@adm.brl.mil> Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: University of California, Berkeley Lines: 33 In-Reply-To: siggins@kodak.com's message of 5 Apr 91 21:29:24 GMT In article <26467@adm.brl.mil> siggins@kodak.com (Richard Siggins, B-150B, Eastman Chemical Company Research, X- 3762) writes: >As a new UNIX systems person I was dismayed to discover that floating point and >integer numbers are not stored in the same format in a binary file on ULTRIX vs >most other UNIX systems. It seems that the bytes are in the reverse order or >some similar condition. It's actually a problem with the architecture used (VAX, MIPS) -- nothing to do with Ultrix. > Does anyone know of a file transfer method that will >correctly translate the data? In particular I am interested in data from an >IBM RS6000 and a DECsystem 5000. There is no general file transfer method that handles arbitrary-endian data. Your best bet is to *convert* the files before transferring them. To do that, you have to know the exact format of the data files. Once you know that, all you have to do is write a program that reads in each data item (depending on the size), reverses the bytes (*not* the bits), and writes it back out again. One more thing: If you have the sources to the programs you run, and anticipate the need to transfer data amongst several different architectures, consider writing out your data in ASCII format. IMHO, it's the only truly portable data format, and you'd only have problems if (a) you have limited disk space [get some more], (b) the data values generated are too large for the destination architecture (eg. trying to store 2^48 in a 32-bit integer) [scale your data if possible], or (c) you use EBCDIC ["dd" to the rescue 8-)]. Good luck!