function TextfileSize(const name: string): LongInt;
var
SRec: TSearchRec;
begin
if FindFirst(name, faAnyfile, SRec) = 0 then
begin
Result := SRec.Size;
Sysutils.FindClose(SRec);
end
else
Result := 0;
end;
It seems to me that the Sysutils.FindClose should be called as the last line of the function. If the Result is zero, doesn’t that leave the FindFirst established and hanging?
function TextfileSize(const name: string): LongInt;
var
SRec: TSearchRec;
begin
if FindFirst(name, faAnyfile, SRec) = 0 then
begin
Result := SRec.Size;
Sysutils.FindClose(SRec);
end
else
Result := 0;
end;
It seems to me that the Sysutils.FindClose should be called as the last line of the function. If the Result is zero, doesn’t that leave the FindFirst established and hanging?