Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-06

Initialize

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ewald Horn

Hi,

silly question but I can't find the answer anywhere...

How do I initialize a variable of the type : textfile ? I keep getting the following hints from the compiler using FPC but I can't figure it out.

Hint: Local variable "inFile" does not seem to be initialized

It's been ages since I've used Pascal and I know I'm missing something but I can't find the answer. "inFile" is of the type textfile. Of course, everything works, it's just I am old school and like it when I run the compiler and get no warnings or hints.

Is there somewhere I'm not looking for the information ?

Kind regards
Ewald Horn
South Africa

Reply by email

Jonas Maebe
to Ewald Horn: silly question but I can't find the answer anywhere... How do I initialize a variable of…
Ewald Horn wrote 6 lines
How do I initialize a variable of the type : textfile ? I keep getting the following hints from the compiler using FPC but I can't figure it out. Hint: Local variable "inFile" does not seem to be initialized

It is because the text/file parameter of assign() is a "var" parameter, and "var" means that the input should already be valid. For some reason, all the assign() variants are defined as

Procedure Assign({$ifdef PARAOUTFILE}out{$else}var{$endif}
t:Text;const s:String);

I don't know why this "PARAOUTFILE" is never defined (maybe a bug in the compiler which causes problems when defining a text/file parameter as "out"?)

Jonas

Reply by email