TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Pascal Schmidt
from: Bo Simonsen
date: 2004-01-17 22:15:04
subject: Re: Big endian machines

-=> Pascal Schmidt wrote to Bo Simonsen <=-

 PS> Hi Bo! :-)

Hi Pascal,

 BS> Could someone please give me a advice of what I should keep in mind,
 BS> then I won't to write Endian-less software?

 PS> Try to keep all data that passes to different hosts or is
 PS> stored on disk in a defined byteorder, for example by using
 PS> htonl() and ntohl() for 32 bit integers. Then, when
 PS> receiving over a network or loading data from disk, convert
 PS> to the host byteorder for further processing.

Aha, it would be the same by reading a packed structure from a file, and 
if the file is written on a little endian machine?

I'm looking into this issue because it looks like that SquishMail has 
problems my reading a packed (__attribute__(packed)) structure from 
diskfile written on a little endian machine.

Bo


... Computer Hacker wanted. Must have own axe.
___ MultiMail/Linux v0.46

--- Maximus/UNIX 3.03b
* Origin: The Night Express - Roennede, Dk (2:236/100)
SEEN-BY: 633/267 270
@PATH: 236/100 237/9 20/11 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.