delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/31/07:08:01

Organization: Technical University of Kielce
Address: Al. Tysiaclecia P.P. 7, 25-314 Kielce, POLAND
Message-ID: <3278F567.1D80@sabat.tu.kielce.pl>
Date: Thu, 31 Oct 1996 13:52:23 -0500
From: Grzegorz Kolodziej <kolodzie AT sabat DOT tu DOT kielce DOT pl>
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Problem with findfirst & findnext

I needed some code to erase work files of my application, the solution
was obvious - only at first sigth :-)

       ....
int res;
struct ffblk FB;
       ....
res=findfirst("*.bin",&FB,FA_ARCH);
while(!res){ unlink(FB.ff_name);
	     res=findnext(&FB); 
	    }
       ....

but it doesn't work ...

The problem is (as it can be seen using gdb):
While findfirst() finds file (res==0) the ffblk structure contains
strange values i.e. field ff_name contains file name without first 
2 letters,ff_fsize is any huge number (other fields aren't correct 
also), so found file  couldn't be deleted by unlink().

I used DJGPP ver. 2.0 on MSDOS 6.20. The same piece of code works
fine if compiled with TC.

What's wrong? Who has any idea? Maybe this problem isn't new - if
so - forgive me.

- Raw text -


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