www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/12/23:44:20

From: Alexander Johannesen <alejohan AT sn DOT no>
Newsgroups: comp.os.msdos.djgpp,comp.programming,comp.unix.programmer,comp.os.msdos.programmer
Subject: Re: quickbasic record to c struct?
Date: Mon, 09 Dec 1996 14:29:49 +0100
Organization: Paperclip Systems
Lines: 36
Message-ID: <32AC144D.5158@sn.no>
References: <58gksj$ign AT butterfly DOT hjs DOT com>
NNTP-Posting-Host: nm13-16.ppp.sn.no
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

John M. Flinchbaugh wrote:

> my problem is that my c program says that the size of that record is
> 224 bytes, while the quickbasic program is using it as a 218-byte
> record.  obviously, this won't due if the c program is to read the files
> written by the old quickbasic program.

Heres my go at this ;

>         char loc[35];
>         char notes[56];
>         char attend[100];

These three should be 1 less than the number, as BASIC
doesn't operate with the 0'th item.

That solves three bytes. I suspect your 3 SHORT int
definitions solves the last three bytes. This is
probably, as you say, the convertion from 16 to 32 bit.

Try to see what the compiler prints when doing

   printf("No. of bytes in short int: %u \n", sizeof(short int)) ; 



Regards,
 
________________________________________________________

  Life is not a mystery to solve, but a puzzle to play
________________________________________________________

  Alexander Johannesen  (alejohan AT sn DOT no)  Oslo, Norway

- Raw text -


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