delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/09/23:50:19

From: Sigurdur Smarason <ssmaraso AT emerald DOT tufts DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: newbie: endianess
Date: 10 Oct 1998 03:01:01 GMT
Organization: Tufts University
Lines: 15
Message-ID: <6vmild$tbu$1@news3.tufts.edu>
References: <6vm3gs$59n$1 AT news3 DOT tufts DOT edu> <361EB530 DOT DD492547 AT cartsys DOT com>
NNTP-Posting-Host: emerald.tufts.edu
X-Trace: news3.tufts.edu 907988461 30078 (None) 130.64.1.16
X-Complaints-To: news AT news DOT tufts DOT edu
X-Newsreader: TIN [UNIX 1.3 unoff BETA 970705; alpha OSF1 V4.0]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Nate Eldredge <nate AT cartsys DOT com> wrote:

: You can't change the endianness, a file is just a bunch of bytes.  If
: you have multi-byte values (i.e. words) that you want to store, you must
: figure that out yourself.  The `htonl' and `ntohl' functions may be
: helpful if what you want doesn't happen to match the CPU's spec.
: -- 

so if I want to read a file that I know is stored in one endian format,
but the program is running on a CPU that is possibly the opposite the only
way I can get the actual values is by swaping the bytes after I read them
?

Siggi

- Raw text -


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