Xref: utzoo comp.lang.c++:13448 comp.lang.c:39284 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!cs.umn.edu!msi.umn.edu!math.fu-berlin.de!unido!ztivax!ap542!david From: david@ap542.uucp Newsgroups: comp.lang.c++,comp.lang.c Subject: Re: 64 bit architectures and C/C++ Message-ID: <1991May15.061253.10286@ap542.uucp> Date: 15 May 91 06:12:53 GMT References: <1991May03.120455.158@buster.stafford.tx.us> <1991May5.175809.2755@ccad.uiowa.edu> Sender: news@ap542.uucp (News Admin) Organization: Siemens-Nixdorf AG, AP 341 Lines: 25 -cadsi@ccad.uiowa.edu (CADSI) writes: ->by rli@buster.stafford.tx.us (Buster Irby): ->> cadsi@ccad.uiowa.edu (CADSI) writes: ->> ->>>Binary isn't in general portable. However, using proper typedefs in ->>>a class one can move binary read/write classes from box to box. ->> ->> What kind of typedef would you use to swap the high and low bytes ->> in a 16 bit value? An Intel or BIG_ENDIAN machine stores the ->> bytes in reverse order, while a Motorolla or LITTLE_ENDIAN ->> machine stores the bytes in normal order (High to low). There is ->> no way to fix this short of reading the file one byte at a time ->> and stuffing them into the right place. -> ->The big/little endian problem is handled via swab calls. ->AND, how do we know when to do this???? We just store ->the needed info in a header record. NO, NO, NO! The way to do this is to use XDR. **========================================================================** David E. Smyth david%ap542@ztivax.siemens.com <- I can get your mail, but our mailer is broken. But I can post. You figure... **========================================================================**