delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/27/19:15:37

From: acottrel AT magna DOT com DOT au (Andrew Cottrell)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP / 32bit <-> 16bit files r/w !?
Date: Fri, 27 Mar 1998 23:53:58 GMT
Organization: Magna Data - Internet Solutions Provider
Message-ID: <351f3b3c.2063065@news.magna.com.au>
References: <351ce359 DOT 12489868 AT news DOT on-luebeck DOT de>
NNTP-Posting-Host: saccess-08-037.magna.com.au
Mime-Version: 1.0
Lines: 26
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Fri, 27 Mar 1998 00:23:54 +0100, DarkSoft AT GMX DOT Net (^Hawk^ (Thorsten
Kaben)) wrote:

>Hello !
>
>I've a problem ... I've a given struct of a 16bit file where an int
>16bit is and a lon 32bit (only a 16bit file struct :) ... so far so
>good ... but how can I read / write 16bit files with DJGPP !?
>
>If I try to translate the structs and read / write the 16bit files
>then I've never the stored datas and at the writing are my created
>files always to long ... if I've a file that's 338 bytes long and I
>try to write the same file then it's 588 bytes long ... :((= ...
>
>Any hints !? What must / can I do !?
>
>Bye, ^Hawk^. http://www.bubis.com/DarkSoft/

If you want to make the source code portable between all compilers the
only safe way to write the code is to use byte read/writes and then
convert to/from ints. It is time consuming to write, but once done it
can work with big endian or little endian systems and all standard
compilers for major OS's (Unix, Win, DOS, VMS, Solaris........etc).


Andrew

- Raw text -


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