delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/10/13:26:31

From: Sigurdur Smarason <ssmaraso AT emerald DOT tufts DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: newbie: endianess
Date: 10 Oct 1998 17:20:54 GMT
Organization: Tufts University
Lines: 28
Message-ID: <6vo51m$ti1$1@news3.tufts.edu>
References: <Pine DOT OSF DOT 4 DOT 05 DOT 9810100531010 DOT 24858-100000 AT sable DOT ox DOT ac DOT uk>
NNTP-Posting-Host: emerald.tufts.edu
X-Trace: news3.tufts.edu 908040054 30273 (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

thanks for all your help guys, I really appreciate it.

so there's no way of actually telling the program to open a file and use a
certain endianness to read or write to it then.  I know that e.g. in
matlab when you are using their fopen the syntax is: 

fopen("filename","permission","architechture")

 where "permission" is equal to mode in DJGPP, and "architecture" 
determines the endianess of the file, so that everytime you read/write to
that specific file the data gets saved in the selected format.

Right now I swap the bytes after I read them or before I write them, but
it is becoming more complicated to do so as the program evolves, I'm
starting to wonder how complicated is it to overload the fopen in DJGPP to
include a syntax similar to the one I mentioned above ? I haven't even
started looking at the source for fopen so I have really no idea what I
would be getting myself into. Would this be a reasonable way of
simplyfying my code or am I opening myself up for more trouble ? 

unfortunately I have to conform to an outside requirement of
reading/writing in big endian since some of the files that I am using are
created with a program that I have no control over and belive it or not
was designed to conform to the old pascal OS way of storing data even
though it runs under DOS/win3.1.  Otherwise I would not have this problem
at all. 

 Siggi

- Raw text -


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