| delorie.com/archives/browse.cgi | search | 
| Xref: | news2.mv.net comp.os.msdos.djgpp:7114 | 
| From: | Robert Hoehne <Robert DOT Hoehne AT Mathematik DOT tu-chemnitz DOT de> | 
| Newsgroups: | comp.os.msdos.djgpp | 
| Subject: | Re: Problems with findfirst/findnext under DOS/Win95 and DJGPP 2.0 | 
| Date: | Mon, 12 Aug 1996 12:25:17 +0200 | 
| Organization: | TU Chemnitz-Zwickau | 
| Lines: | 46 | 
| Message-ID: | <320F068D.4560@Mathematik.tu-chemnitz.de> | 
| References: | <4uli4p$bmi AT news DOT sct DOT fr> | 
| NNTP-Posting-Host: | tantalus-e.hrz.tu-chemnitz.de | 
| Mime-Version: | 1.0 | 
| To: | Olivier Bouton <chiron AT worldnet DOT fr> | 
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp | 
Olivier Bouton wrote:
> I wanted to translate one of my C++ DOS (real mode) program to DJGPP that use
> findfirst/findnext; it compiled OK, but when it calls findfirst/findnext, names
> of files it find (pointed by ffblk.ff_name) don't have their first two chars !
> 
This is a known bug in cc1plus (the C++ compiler). To solve your problem you should
use either a C-file for the functions which handle with the ffblk struct or you do this
like I. I wrote a little C-file with functions for accessing the fields in the struct and
call this functions from from a C++-file. The C-file looks like this:
-------------------------------------------
#include <dir.h>
unsigned short ffattrib(struct ffblk *ff)
{
  return ff->ff_attrib;
}
unsigned short ffdate(struct ffblk *ff)
{
  return ff->ff_fdate;
}
unsigned short fftime(struct ffblk *ff)
{
  return ff->ff_ftime;
}
unsigned long ffsize(struct ffblk *ff)
{
  return ff->ff_fsize;
}
char * ffname(struct ffblk *ff)
{
  return ff->ff_name;
}
-------------------------------------------
If I want to access the ff_name field of a ffblk-variable I call the function ffname.
Robert
-- 
*****************************************************************
* Robert Hoehne, Fakultaet fuer Mathematik, TU-Chemnitz-Zwickau *
* Post:    Am Berg 3, D-09573 Dittmannsdorf                     *
* e-Mail:  Robert DOT Hoehne AT Mathematik DOT TU-Chemnitz DOT DE              *
* WWW:     http://www.tu-chemnitz.de/~rho                       *
*****************************************************************
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |