[fpc-devel] Local variable X does not seem to be initialized as a "TextFile" value
TOUZEAU DAVID
david.touzeau at fr.kaspersky.com
Fri Dec 28 12:06:06 CET 2007
Dear
I have many warning like
(966,12) Hint: Local variable "X" does not seem to be initialized that
X is a TextFile
I understand that only X is initialized when assign() it
How to prevent this warning ?? How to initialize a TextFile value...
example
procedure Xseen(line:string);
var
zDate:string;
myFile : TextFile;
xText:string;
TargetPath:string;
BEGIN
xText:='';
writeln('log::' + line);
TargetPath:='/var/log';
zDate:=DateToStr(Date)+ chr(32)+TimeToStr(Time);
xText:=zDate + ' ' + line;
TRY
AssignFile(myFile, TargetPath);
if FileExists(TargetPath) then Append(myFile);
if not FileExists(TargetPath) then ReWrite(myFile);
writeln(myFile, line);
CloseFile(myFile);
EXCEPT
END;
END;
--
David Touzeau -------------------------- Linux Ubuntu 7.04 feisty
FreePascal-Lazarus,perl,delphi,php artica for postfix management console
(http://www.artica.fr) icq:160018849
More information about the fpc-devel
mailing list