[fpc-pascal] how to initialize a SearchRec var?

waldo kitty wkitty42 at windstream.net
Thu Jan 2 20:21:20 CET 2014



understanding that SearchRec has different formats for different OS targets, 
we've tried to use fillchar to initialize it to an empty record... unfortunately 
that does not remove the hint... instead the hint points to the fillchar line...

we do not want to turn off hints so how can we initialize dirinfo and make fpc 
happy?


[quote="os/2 ecs"]
Hint: Start of reading config file fpc.cfg
Hint: End of reading config file fpc.cfg
Free Pascal Compiler version 2.6.2 [2013/02/09] for i386
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: OS/2
Compiling dirinfo.pas
dirinfo.pas(13,19) Hint: Variable "dirinfo" does not seem to be initialized
Assembling test_searchrec
Linking dirinfo.exe
emxbind 0.9d -- Copyright (c) 1991-1997 by Eberhard Mattes
Deleting *path*\projects\satsort\dirinfo.out
      1 file deleted         335,872 bytes freed
16 lines compiled, 3.9 sec
3 hint(s) issued
[/quote]


[quote]="vista"]
C:\freepascal\projects\misc_projects>fpc -vhinw dirinfo.pas
Hint: Start of reading config file fpc.cfg
Hint: End of reading config file fpc.cfg
Free Pascal Compiler version 2.7.1 [2013/12/05] for i386
Copyright (c) 1993-2013 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling dirinfo.pas
dirinfo.pas(13,19) Hint: Variable "dirinfo" does not seem to be initialized
Linking dirinfo.exe
16 lines compiled, 0.8 sec, 28304 bytes code, 1524 bytes data
3 hint(s) issued
[/quote]


[quote="dirinfo.pas"]
program test_SearchRec;

uses
   Dos;

const
   pattern : string = '*.pas';

var
   dirinfo : SearchRec;

begin
   fillchar(dirinfo,sizeof(dirinfo),$00);
   FindFirst(pattern,AnyFile,dirinfo);
   findclose(dirinfo);
end.
[/quote]

-- 
NOTE: No off-list assistance is given without prior approval.
       Please keep mailing list traffic on the list unless
       private contact is specifically requested and granted.



More information about the fpc-pascal mailing list