[fpc-devel] Unexpexted result of FindFirst with 2.2.4

Stefan Kisdaroczi kisda at hispeed.ch
Tue Apr 21 16:47:54 CEST 2009

Hi all,

FindFirst from fpc 2.2.4 returns zero (file found) and an empty Name if I search for files in a empty directory.
With fpc 2.2.2 FindFirst returns -1 as expected.

Im using Debian Lenny (i386) and installed the 2.2.4 *.deb's from the freepascal ftp site.

The following program is quiet with fpc 2.2.2, with 2.2.4 the output is:
Found:  Len=0

Can someone please confirm this. Thank you.
greetings kisda

program fpc_find;

uses sysutils;

var SearchRec : TSearchRec;

  if ( FindFirst('./empty_dir/*', faAnyFile - faDirectory, SearchRec ) = 0 ) then
  with SearchRec do
    writeln( 'Found : ', Name,' Len=', length(Name) );
  FindClose( SearchRec );

(dont forget: mkdir ./empty_dir)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20090421/ed026a36/attachment.sig>

More information about the fpc-devel mailing list