delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/31/02:54:53

Date: Wed, 31 Dec 1997 09:54:45 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Dave Nugent <dave DOT nugent AT ns DOT sympatico DOT ca>
cc: djgpp AT delorie DOT com
Subject: Re: Why does DJGPP's getw not read Borlands getw?
In-Reply-To: <34A96539.424E@ns.sympatico.ca>
Message-ID: <Pine.SUN.3.91.971231095422.3217O-100000@is>
MIME-Version: 1.0

On Tue, 30 Dec 1997, Dave Nugent wrote:

> Can someone explain to me why I have a file that was created in Borlands
> Turbo C++ v3.0  that wrote a bunch of integers can't be read properly in 
> DJGPP?

An int is 16 bit in Borland C, but DJGPP uses 32-bit ints, that's
why.  Use short in DJGPP to get a 16-bit int.

Note that it is usually a *very* bad idea to share binary data between
different compilers, as they have their private trick of laying out
data in memory.  The speed gain in reading binary data is IMHO not
worth the hassle you get to make code that reads binary data work with
another compiler.  Make your files ASCII and live happily ever after.

- Raw text -


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