You are not alone Michael, I also have to rewrite all of my FindFirst...FindClose calls :).
By reading the documentation a little more, I found that the unit OldLinux includes the Glob() function to search for files in Linux. This function returns a pointer that must be explicitly disposed by the GlobFree function, it doesn't matter if files where found or not. I can't confirm this, but maybe FindFirst in linux is a wrapper to Glob, and that's why FindClose (in Linux) must be called outside the if. Leonardo M. Ramé http://leonardorame.blogspot.com --- On Mon, 5/18/09, Michael Van Canneyt <mich...@freepascal.org> wrote: > From: Michael Van Canneyt <mich...@freepascal.org> > Subject: Re: [fpc-pascal] FindFirst...FindClose > To: "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org> > Date: Monday, May 18, 2009, 12:25 PM > > > On Mon, 18 May 2009, Jonas Maebe wrote: > > > > > On 18 May 2009, at 16:39, Leonardo M. Ramé wrote: > > > > >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?. > > > > Yes. > > Huh ? Since when is this requirement ? > > If it is correct, 100% of my FindFirst/FindClose code must > be rewritten ! > > Michael. > -----Inline Attachment Follows----- > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal