Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!yale!mintaka!bloom-beacon!daemon From: scs@adam.mit.edu (Steve Summit) Newsgroups: comp.lang.c Subject: Re: Help with C between 68000 & 80286 Keywords: Help,Bits,Bytes,Swap,Convert Message-ID: <1990Aug7.023429.19786@athena.mit.edu> Date: 7 Aug 90 02:34:29 GMT References: Sender: daemon@athena.mit.edu (Mr Background) Reply-To: scs@adam.mit.edu (Steve Summit) Organization: Thermal Technologies, Inc. Lines: 23 In article lodzins@pilot.njin.net (Dean Lodzinski) writes: >I have numerous datafiles that were >created using Mark Williams C on a 68000 machine. I am trying to read >in the data files using Power C 2.0 or Quick C 2.5 on my AT. Since >Intel reads the bytes differently, I can't directly use the data. It may be best to convert the files to ASCII (using printf %d, %e, etc.), transport them, and then read them in (or convert them back) with scanf and/or atoi, atol, atof, etc. You may find yourself wishing that the data files had been written in a text format originally (I certainly would, if I were stuck with this problem). ASCII text data files are usually preferable for this very reason (and for several other reasons). Some will claim that ASCII storage, with its inherent formatting on output and parsing on input, is too inefficient, but this is often not true in practice. I think I'll add this to the FAQ list; it comes up all the time. (Worry not, efficiency hackers, I'll try not to editorialize in favor of ASCII storage too much.) Steve Summit scs@adam.mit.edu