ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/30/02:06:41

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: findfirst function
Date: Sat, 30 Nov 1996 00:17:46 -0800
Organization: Three pounds of chaos and a pinch of salt
Lines: 34
Message-ID: <329FEDAA.3FB4@cs.com>
References: <329FB276 DOT 78EE AT wyellowstone DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp102.cs.com
Mime-Version: 1.0
To: Rusty Conover <RConover AT wyellowstone DOT com>
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Rusty Conover wrote:
> 
> Hello,
> 
> I am having trouble using the findfirst() function, when I use the
> example in the docs and when I write my own function the same event
> occurs.  The filename's first two characters are dropped, and the file's
> size is totally wrong.  I am inserting a code sample below:
> 
> Could you please find out what I or the docs are doing wrong, and let me
> know.  Thank you for your time.

This is a well-known bug in <dir.h> of DJGPP v2.00, caused by the fact
that the gcc 2.7.2 compiler does not pack structs correctly in C++.  The
workaround is to find the struct ffblk definition in <dir.h> and
surround it with:

#pragma pack(1)
...
#pragma pack()

The solution is to get the latest version of DJGPP, v2.01, which
includes fixed header files and (I think) a fixed gcc.  Be sure to
download the latest version of gcc, 'gcc2721b.zip'.

BTW, this problem is described in detail in the DJGPP FAQ
(v2/faq202b.zip), section 22.10.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I |        fighteer AT cs DOT com          |
| Proud owner of what might one   |   http://www.cs.com/fighteer    |
| day be a spectacular MUD...     | Plan: To make Bill Gates suffer |
---------------------------------------------------------------------

- Raw text -


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