Date: Tue, 1 Dec 1998 10:44:23 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: dalitz cc: djgpp AT delorie DOT com Subject: Re: Strange behavior of fread In-Reply-To: <36630cd2.17414449@news.extension.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Mon, 30 Nov 1998, dalitz wrote: > It seems to me that the order of two subsequent bytes > is swapped in the buffer when the fread function reads items of > two bytes (short int). I really don't understand what's going > on. As others have explained, this is due to the differences in byte order between HP and Intel CPUs. You can use library functions `ntohs' and `ntohl' to convert the byte order of, respectively, 16-bit shorts and 32-bit ints.