delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/08/11:11:22

Xref: news2.mv.net comp.os.msdos.djgpp:3569
From: Gert-Jan Schoenmakers <tgtcgs AT tc0 DOT chem DOT tue DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: Structure size
Date: Wed, 08 May 1996 13:45:32 +0200
Organization: TU Eindhoven
Lines: 70
Message-ID: <3190895C.41C6@tc0.chem.tue.nl>
NNTP-Posting-Host: sg12.chem.tue.nl
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is a multi-part message in MIME format.

--------------167E2781446B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I've recently switch from Microsoft C/C++ 7.0 to djgpp 2.0 for
developping signal processing software. Now I have a trouble reading
binary data files which consist of a header and an amount of data. The
recent discussion about the sizeof(int) was a first step in solving the
problems I had (I redifined the int's to short int's) but now I'm stuck.
The MSC compiled program tells me sizeof(struct header)=98 and the DJGPP
compiled program tells me sizeof(struct header)=100.... Can someone help
me out on this one ????

J.H.A. Schoenmakers
Ph.D. student Eindhoven University of Technology
Faculty of chemistry & chemical engineering
e-mail:tgtcgs AT chem DOT tue DOT nl

--------------167E2781446B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="struct"

struct header {
    short int shift;
    short int ied;
    short int units;
    short int coll_mode;
    short int rejection;
    short int clock_source;
    short int coin;
    short int qfactor;
    short int anode_crt;
    short int burst_detect;
    short int buffer_mode;
    short int at_base;
    short int osize_reject;
    short int output_data_fmt;
    short int hv_on_off;
    short int fl;
    long num_samples;
    long bursts_req;
    long bursts_val;
    float data_rate;
    float duty;
    float dead;
    float calib;
    float recint;
    float pos[3];
    float shifter;
    short int manual_shift;
    short int timeout;
    short int data_valid;
    short int rec_len;
    short int gain;
    short int attn;
    short int hv;
    short int span_index;
    short int center_index;
    }*head;
   }

   head = (struct header *)malloc(sizeof(struct header));

   fprintf(stderr,"Sizeof header = %d\n",sizeof(struct header));

--------------167E2781446B--

- Raw text -


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