🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3535

Re: Behaviour if Findfirst/Findnext

#3535
From: Bruce Salzman
Date: Thu, 25 May 2006 16:20
35 lines
2243 bytes
"Jos�" <jose@127.0.0.1> wrote in message 
news:5v4b725541pgl6mgme0m2sc5n0ni1bm94p@4ax.com...
> Dear friends
>
> There are two sets of functions to search for files:
> findfirst/findnext and FindFirst/FindNext.
>
> It is my impression that their behaviour differs on differint
> computers. Can anything be said about this?
>
> 1. What is the order of files? It can be arbitrary, numeric (2, 19,
> 20) and alphabetic (19, 2, 20)


I don't know for sure, but I'd guess that these functions search the 
file allocation table from beginning to end. That is, the first file 
returned will be first first one in the FAT that matches the search 
criteria. Since the OS re-uses deleted entries, the order may not 
correspond to the creation times of the files. This means that the 
file orders are essentially random.

> 2. What happens when files are created, deleted or renamed between 
> two
> invokations of findnext/FindNext?

If you are part way through the FAT, any change that happens "behind" 
the current position will go unnoticed. The ones "ahead" will be 
discovered when you call findnext. So you can't be sure that you have 
seen everything. I think you can lock a folder using CreateFile() and 
specifying FILE_FLAG_BACKUP_SEMANTICS. I haven't tried this in 
conjunction with using the Find functions, though.

HTH,
Bruce 
Technical Details
Message-ID: <4475d95a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <5v4b725541pgl6mgme0m2sc5n0ni1bm94p@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,57df08767886389
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII
From: " Bruce Salzman" <bruce@nospam.org>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <5v4b725541pgl6mgme0m2sc5n0ni1bm94p@4ax.com>
Subject: Re: Behaviour if Findfirst/Findnext
Date: Thu, 25 May 2006 11:20:44 -0500
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 24.94.228.231
Message-ID: <4475d95a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1148574042 24.94.228.231 (25 May 2006 09:20:42 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail