Subj : sweep
To   : Eddy Thilleman
From : Jonathan de Boyne Pollard
Date : Sat Aug 04 2001 03:29 am

JdBP>> 1.    Change your calls to DosFind{First,Next} to grab many
JdBP>> directory entries in a single call, rather than just a single one
JdBP>> (and then have an inner loop that iterates over the buffer entry
JdBP>> by entry).

ET> Do I need to change or replace the lines with DosFindFirst() and
DosFindNext()
ET> or should I just change the number of entries to find?  Problably I need
extra
ET> calls to DosFindFirst() and DosFindNext() to iterate over entries in the
buffer?
ET> How would I make them work with the entries in the buffer?

Use a big buffer.  I use 4KiB most of the time, but that's just an arbitrary
choice on my part.  (Many people make the mistake of using a FILEFINDBUFn
structure for the buffer.  Just use an array of "char".)  Once you have
populated the buffer with a call to DosFindFirst() or DosFindNext(), enter an
inner loop that iterates over all of the FILEFINDBUFn structures in the buffer.

------------------------------------------------------------------------------------------
#define BSIZE 4096

char buf[BSIZE] ;
HDIR handle = HDIR_CREATE ;
const unsigned long wanted = BSIZE / (sizeof(FILEFINDBUF3) - CCHMAXPATHCOMP +
16) ;
unsigned long count = wanted ;

if (NO_ERROR == DosFindFirst(wildcard, &handle, attributes, buf, BSIZE, &count,
FIL_STANDARD)) {
   do {
       const FILEFINDBUF3 * fb = (const FILEFINDBUF3 *)(char *)buf ;
       while (count--) {
           // Do something with *fb
           fb = (const FILEFINDBUF3 *)((char *)fb + fb->oNextEntryOffset) ;
       }
   } while (count = wanted, NO_ERROR == DosFindNext(handle, buf, BSIZE,
&count)) ;
   DosFindClose(handle) ;
}
------------------------------------------------------------------------------------------

� JdeBP �

--- FleetStreet 1.22 NR
* Origin: JdeBP's point, using Squish <yuk!> (2:257/609.3)