Description
|
The FindClose
function closes a successful
FindFirst (and
FindNext) file search. It frees up
the resources used by the search in
SearchResults.
A FindClose call is
not necessary if FindFirst finds
nothing, but must be called if it does, even if a
subsequent FindNext call fails.
|
|
Related commands
|
FileSearch
|
|
Search for a file in one or more directories
|
FindFirst
|
|
Finds all files matching a file mask and
attributes
|
FindNext
|
|
Find the next file after a successful
FindFirst
|
TSearchRec
|
|
Record used to hold data for
FindFirst and
FindNext
|
|
|
|
|
Example code : Show when
to call FindClose
|
var
searchResult : TSearchRec;
begin
// Try to
find regular files matching Unit1.d* in the current
dir
if FindFirst('Unit1.d*', faAnyFile,
searchResult) = 0 then
begin
repeat
WriteLn('File
name = '+searchResult.Name);
WriteLn('File
size = '+IntToStr(searchResult.Size));
until
FindNext(searchResult) <> 0;
// Must free up resources used by
these successful finds
FindClose(searchResult);
end;
end;
|
Show full unit code
|
File name = Unit1.dcu
File size = 4382
File name = Uni1.dfm
File size = 524
File name = Uni1.ddp
File size = 51
|
|