From: Erwann ABALEA Newsgroups: comp.os.msdos.djgpp Subject: Re: Strange behavior of fread Date: Tue, 1 Dec 1998 01:17:24 +0100 Organization: Certplus SA Lines: 21 Message-ID: References: <36630cd2 DOT 17414449 AT news DOT extension DOT net> NNTP-Posting-Host: fermi.cnam.fr Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Sender: abalea_e AT fermi DOT cnam DOT fr In-Reply-To: <36630cd2.17414449@news.extension.net> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Mon, 30 Nov 1998, dalitz wrote: > I observed an unexpected behavior of fread. > 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. Didn't you know things like little endian and big endian? a PC is big endian, and I'm pretty sure that the HP-PA architecture works the other way... Like someone else replied, try to read your file one byte at a time, or a bunch of bytes in an array of unsigned chars, and build your own integers by yourself... -- Erwann ABALEA eabalea AT certplus DOT com