for the record, ---------- Forwarded message ---------- From: Luis Rivera <jlrn77@gmail.com> Date: 22 May 2010 11:53 Subject: Re: findfiles syntax To: leledumbo On 22 May 2010 03:00, leledumbo <leledumbo_cool@yahoo.co.id> wrote:
From the reference: type TStringProc = procedure (const s: String);
procedure FindFiles (const Directory, Mask: String; MainDirFirst: Boolean; FileAction, DirAction: TStringProc); attribute (iocritical);
How you call it: findfiles(mydir,a,false,reset,nil);
mydir is of type string => matches Directory type a is of type text => doesn't match Mask type false is of type boolean => matches MainDirFirst type reset is a procedure to open file for reading, it's of type procedure (f: text) for text files => doesn't match FileAction type TStringProc (see above) nil is a pointer pointing to address 0, which is a reserved location for unallocated vars => doesn't match DirAction type TStringProc (see above)
Can you see where the mistakes are now?
I do. However, one thing that bothers me is that the sample code at findfilesdemo.pas mentioned earlier in this thread includes the line FindFiles (DirSelf, '*.{pas,p,pp,dpr}', False, DoOutput, nil); as an example. Now I wonder why it compiles and runs if nil shouldn't match. Thanks, -- Luis Rivera O< http://www.asciiribbon.org/ campaign -- Luis Rivera O< http://www.asciiribbon.org/ campaign
participants (1)
-
Luis Rivera