delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/09/11/22:45:57

From: w DOT meissner AT qut DOT edu DOT au (Wayne Meissner)
Subject: Re: sizeof( struct) in DOS( borlandc) is different in GNU (linux)
11 Sep 1997 22:45:57 -0700 :
Message-ID: <Pine.OSF.3.92.970912145404.10990B-100000cygnus.gnu-win32@pigeon.qut.edu.au>
References: <3418054C DOT 64C7 AT newton DOT dgct DOT ice DOT go DOT cr>
Mime-Version: 1.0
To: Jose Freddy Rojas Chavarria <freddy AT ns DOT dgct DOT ice DOT go DOT cr>

This wasn't exactly a gnu-win32 question, but it applies to it as well ...

On Thu, 11 Sep 1997, Jose Freddy Rojas Chavarria wrote:
>
> I have a binary files recorded by a program in BorlandC for DOS, and I
> can't read this file in Linux.
>
> The file is a colection of records of the type
> struct {
>   char usr_id;
>   long info;
> }T_info;

You need to declare this as
struct {
  char usr_id;
  long info;
} __attribute__((__packed__)) T_info;
(syntax is similar to this, I haven't got the info pages here with me).

Or just recompile the file with -fpack-struct, but this makes all structs
compiled with byte packing (including ones declared in system include
files).

Read the gcc info pages.

--wayne

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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