Article View: borland.public.cppbuilder.nativeapi
Article #9113Re: Find a file in one of subdirectories
From: Chris Croughton
Date: Mon, 02 Aug 2004 18:33
Date: Mon, 02 Aug 2004 18:33
26 lines
1954 bytes
1954 bytes
On 2 Aug 2004 09:14:24 -0700, Andrue Cope [TeamB] <no.spam@spammy.com> wrote: > Saulo I. Regis wrote: > >> I was not aware of that! > > Every call to FindFirstFile() creates a directory pointer (my name for > it) and this can be an expensive resource to maintain. Win32 at least > can probably handle a lot of open searches but if you're searching a > network volume you're at the mercy of the remote server. Particularly since Unix servers (at least, I don't know about Windows ones) can have links to other directories, and it is possible to get circular links (A -> B -> C -> A) which will tend to blow up a recursive search unless you pass in a 'depth' parameter to tell how deep the recursion has gone. If you keep them in a list then at least you won't blow the stack, and you can keep track of how big it gets and fail gracefully. It seems that the Win2k/XP search uses some kind of multiple threads, but only a limited number. Presumably this works faster in some situations (I imagine it would when accessing network or slow drives), but at a bigger cost of complexity... Chris C
Technical Details
Message-ID:
<slrncgt27k.5qc.chris@ccserver.keris.net>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mailReferences:
<410e3fb2$1@newsgroups.borland.com> <410e44fc@newsgroups.borland.com> <410e5c92$1@newsgroups.borland.com> <410e5e24$1@newsgroups.borland.com> <410e6860$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,de3e19de7f81211c X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Croughton <chris@keristor.net> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Find a file in one of subdirectories Date: Mon, 2 Aug 2004 19:33:24 +0100 Lines: 26 Message-ID: <slrncgt27k.5qc.chris@ccserver.keris.net> References: <410e3fb2$1@newsgroups.borland.com> <410e44fc@newsgroups.borland.com> <410e5c92$1@newsgroups.borland.com> <410e5e24$1@newsgroups.borland.com> <410e6860$1@newsgroups.borland.com> Reply-To: chris@keristor.net X-Trace: news.uni-berlin.de qiugGYxSVvia3H5EstL7Ew9oYToBCLd26SYum7TmnfLNgaCx0= X-Orig-Path: ccserver.keris.net!news User-Agent: slrn/0.9.7.4 (Linux)