delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/12/25/05:12:26

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Sat, 25 Dec 2004 12:09:21 +0200
From: "Eli Zaretskii" <eliz AT gnu DOT org>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp AT delorie DOT com
Message-ID: <01c4ea69$Blat.v2.2.2$f96dba00@zahav.net.il>
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 2.2.2
In-reply-to: <fi3qs05k7quvrsordlba97rkmdkvrputca@4ax.com> (message from
Radical NetSurfer on Sat, 25 Dec 2004 02:11:42 -0500)
Subject: Re: MAJOR PAIN: Reading Integers!
References: <fi3qs05k7quvrsordlba97rkmdkvrputca AT 4ax DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Radical NetSurfer <RadSurfer AT yahoo DOT com>
> Date: Sat, 25 Dec 2004 02:11:42 -0500
> 
> 7. Conclusion:
>     Except for being "clever" at using *4* fread's
>     or by re-arranging a unsigned char, byte-by-byte
>     using shifts and ors,
>     I just see NO WAY to directly read in Integer
>     Values without being "corrupted" by Intel's expectations!
> 
>     what other method(s) are available to achieves this that
>     I may of missed?

Did you try a union like below?

 union lbf {
  unsigned char buf[4];
  unsigned long bf;
 } abf;

I think reading into abf.buf[] and then using abf.bf will do what you
want.  Does it?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019