Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FindFirst/FindNext Bug

16 views
Skip to first unread message

Bjorn Mossberg

unread,
Mar 4, 2008, 8:34:11 AM3/4/08
to
FindFirst and FindNext interprets the mask '*.xyz' as '*.xyz*'

procedure FindFirstNextBug;
var
found: Integer;
aMask: String;
fName: String;
aPath: String;
aList: TStringList;
fsr: TSearchRec;
begin
aPath := GetCurrentDir;
{Only *.doc files should be found, but *.docx files are also in the list!}
aMask := aPath + '\*.doc';
aList := nil;
found := FindFirst(aMask,faAnyFile XOR faDirectory,fsr);
try
aList := TStringList.Create;
while found=0 do begin
aList.Add(aPath + '\' + fsr.Name);
found := FindNext(fsr);
end;
DisplayStringList(aList); {Use your favorite display method here.}
finally
SysUtils.FindClose(fsr);
aList.Free;
end;
end;


Craig Stuntz [TeamB]

unread,
Mar 4, 2008, 8:01:12 AM3/4/08
to
Bjorn Mossberg wrote:

> FindFirst and FindNext interprets the mask '*.xyz' as '*.xyz*'

"It's not a bug; it's a feature."

http://blog.excastle.com/2007/10/01/83-backward-compatibility-or-why-dpr-returns-dproj-files/

--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
How to ask questions the smart way:
http://www.catb.org/~esr/faqs/smart-questions.html

0 new messages