Date: Sun, 12 May 1996 09:53:33 +0200 (IST) From: Eli Zaretskii To: Shawn Hargreaves Cc: djgpp AT delorie DOT com Subject: Re: i/o file handling - intege In-Reply-To: Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 9 May 1996, Shawn Hargreaves wrote: > If you are interested in portability, it is worth considering the > implications of endianess. [snip] > The best way I've found to deal with this is to define two versions of > getw and putw, one for each endianness. You call whichever one your file > format is using, making sure always to read 16 and 32 bit variables with A better way is to convert your int's to the so-called ``network'' format by calling `htonl' library function (and `ntohl' for the reverse conversion). These functions are POSIX and ensure the data written to the file can be read on any other machine that has a POSIX compiler.