www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/14/15:59:04

Message-ID: <37B5BA42.3F05CED2@unb.ca>
From: Endlisnis <s257m AT unb DOT ca>
X-Mailer: Mozilla 4.61 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: From Bytes to Int and Char
References: <rfXs3.4$bZ1 DOT 1603 AT typhoon01 DOT swbell DOT net> <37B466D7 DOT 958F09E5 AT americasm01 DOT nt DOT com> <37B4DFD1 DOT 4D66 AT surfsouth DOT com> <37B57EB0 DOT 492A93AE AT unb DOT ca> <37B5877D DOT 2343 AT surfsouth DOT com>
Lines: 25
Date: Sat, 14 Aug 1999 18:50:49 GMT
NNTP-Posting-Host: 209.226.124.241
X-Trace: news21.bellglobal.com 934656649 209.226.124.241 (Sat, 14 Aug 1999 14:50:49 EDT)
NNTP-Posting-Date: Sat, 14 Aug 1999 14:50:49 EDT
Organization: Sympatico
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Chris Holmes wrote:

> >     I don't see how, because it's doing the exact same thing in a more obsure way.
> > I was trying to say that if the file was stored on a big-endian machine, then using
> > a little-endian like DJGPP to read the file in the way I mentioned wouldn't work.
>   The difference is that you're telling the compiler to do the magic
> here, so if you compiled it on a big-endian compiler, then it should
> do it right.  I'm just trying to save some time spent recoding.
>   Chris

    But, your code did the same thing, it casted it as a short* (which you stored in a
temporary variable) and then augmented it with an offset.  You code would do the EXACT
same thing as mine on any and all machines.  Both mechanisms were interpreting the int in
a 'native' way.  What I was trying to say, was that if the file was saved in a big-endian
machine and you were using a little-endian machine... both of our codes would not work.



--
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT HotMail DOT com
          ICQ: 32959047


- Raw text -


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