Re: Dir() question
- From: "Tony Proctor" <tony_proctor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 24 Apr 2007 16:15:11 +0100
As well as the locking issues (which can be freed using a token call to
Dir$("nul")), and the re-entrancy issues, there are also wildcard issues
with Dir$ Rob. See
http://groups.google.ie/group/microsoft.public.vb.general.discussion/msg/a0ff878889e6f52f
for a mention.
Tony Proctor
"Robert Morley" <rmorley@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:Oy9WnBfhHHA.4732@xxxxxxxxxxxxxxxxxxxxxxx
Ah, okay, I was aware of the directory locking issues of Dir() and the
possibility of competing Dir() commands getting confused. I hadn't
considered going with the API commands, though. For my purposes, it's
unlikely to matter, but it's something I'll look into later, when I have
more time to revise my code.
Thanks,
Rob
"J French" <erewhon@xxxxxxxxxx> wrote in message
news:462c5b39.4097212@xxxxxxxxxxxxxxxxxxxxxxx
On Sun, 22 Apr 2007 17:31:49 -0400, "Robert Morley"
<rmorley@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi Mike,
Dir is not a good choice for this for a number of reasons.
Can you elaborate on this a bit more?
If you are in a Dir() loop, then another call to Dir upsets the loop
- you can't have more than one running at a time
As a result it is generally good policy to avoid the use of Dir()
especially in 'buried' routines.
The best solution is to use the FindFirstFile / FindNextFile /
FindClose APIs
However, in this case the GetAttr function will work fine, although
there have been reports that it misbehaves on some networks, I think
those problems were legacy.
To be honest I doubt if GetAttr is any faster, as it still has to
locate the file in the directory structure
- but using it will save potential grief from disrupted Dir routines
.
- Follow-Ups:
- Re: Dir() question
- From: Robert Morley
- Re: Dir() question
- References:
- Re: Dir() question
- From: MikeD
- Re: Dir() question
- From: Argusy
- Re: Dir() question
- From: Robert Morley
- Re: Dir() question
- From: MikeD
- Re: Dir() question
- From: MikeD
- Re: Dir() question
- From: Robert Morley
- Re: Dir() question
- From: J French
- Re: Dir() question
- From: Robert Morley
- Re: Dir() question
- Prev by Date: Re: Media Control
- Next by Date: Re: How to get host PC's Language setting
- Previous by thread: Re: Dir() question
- Next by thread: Re: Dir() question
- Index(es):
Relevant Pages
|