Date: Tue, 02 Jan 2001 19:00:05 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Tom St Denis Message-Id: <2593-Tue02Jan2001190005+0200-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 CC: djgpp AT delorie DOT com In-reply-to: <92snm5$skf$1@nnrp1.deja.com> (message from Tom St Denis on Tue, 02 Jan 2001 14:13:30 GMT) Subject: Re: findfirst/findnext woes References: <92snm5$skf$1 AT nnrp1 DOT deja DOT com> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: Tom St Denis > Newsgroups: comp.os.msdos.djgpp > Date: Tue, 02 Jan 2001 14:13:30 GMT > > > > On Tue, 2 Jan 2001, Tom St Denis wrote: > > > > > Anyways... My code only finds the first file then findnext() returns > > > 1... ALWAYS! [snip] > Here is the entire program (minus the bzip lib of course) (one huge > main file... the way programs of this caliber should be written... > hehehehe) [snip] > f = findfirst(argv[3], &fb, FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCH); You didn't supply one crucial piece of info: how did you invoke this program. However, from the code I'm guessing that you invoke it like this: bz e archive *.c The important part is that the last argument includes wildcard characters. Your intention was that the wildcard gets intact into the program, where it is passed to findfirst as argv[3]. But that's not what happens with DJGPP. In DJGPP programs, the startup code always expands all the wildcards _before_ it puts them into the argv[] array. This is explained further in section 16.1 of the DJGPP FAQ list. So you actually pass to findfirst a single file name, the first file that matches the widlcard typed on the command line. That's why findnext returns 1: there's only one file with that name, and findfirst already found it. What you want to do is to disable wildcard expansion in this program. Section 16.2 of the FAQ will explain how.