[fpc-pascal] FindFirst...FindClose
Leonardo M. Ramé
martinrame at yahoo.com
Mon May 18 16:39:00 CEST 2009
Hi, I ported a Delphi service to linux using FPC. The app uses FindFirst, FindNext and FindClose the same way Delphi Help shows:
if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then
begin
repeat
...
...
until FindNext(sr) <> 0;
FindClose(sr);
end;
Apparently my program gets stuck after a couple (several, in fact) of calls to the function that includes this code.
By reading the FPC.RTL documentation, I found it says that FindClose must be used outside the if, as follows:
if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then
begin
repeat
...
...
until FindNext(sr) <> 0;
end;
FindClose(sr);
Can be this the cause of the problem in my application?.
Thanks in advance.
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the fpc-pascal
mailing list