[fpc-pascal] How to initialize a "Text" variable?
Jonas Maebe
jonas.maebe at elis.ugent.be
Sat Mar 15 22:46:20 CET 2008
On 15 Mar 2008, at 12:34, Felipe Monteiro de Carvalho wrote:
> I have the following variable that I need to initialize:
>
> yyinput: Text;
>
> I searched, but I can't find anything that explains what this is, or
> how to initialize it. Is the Text type the same as TextFile?
Yes (although more the other way around: Text is a standard Pascal
type, while TextFile is an alias for Text introduced in Delphi).
> I would like to set this variables to the contents of a file, so I
> tryed the following, but it crashes with runtime error 123 ( 'No
> medium found' ) and no error message.
>
> AssignFile(lexlib.yyinput, AFileName);
Normally, you would use plain assign() with Text files, but AssignFile
maps through to that.
> Reset(lexlib.yyinput) ;
>
> fmlscan.yylex();
>
> CloseFile(lexlib.yyinput) ;
Same remark as for assign() here (close vs closefile)
So your error is unrelated to the use of assign(file)/close(file), it
is something else.
Jonas
More information about the fpc-pascal
mailing list