Initialize

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Initialize

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Initialize

Jonas Maebe-2

On 21 jun 2006, at 20:38, Ewald Horn wrote:

> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Initialize

Ewald Horn
Hi Jonas,

thanks for the answer! I had this horrible nightmare that I am writing icky
code that was going to crash and burn on me some time. The mailing seems
extremely quiet, is everyone very smart or is there another reason for it ?
I'm not even sure if I can post questions about Pascal programming to this
list.

Regards
Ewald Horn

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Initialize

Marco van de Voort
> The mailing seems extremely quiet, is everyone very smart or is there
> another reason for it ?  I'm not even sure if I can post questions about
> Pascal programming to this list.

The lists changed server machines in the past week. Only today most services
should be fully up and running again.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal