[fpc-pascal] Test file mode question

Rolf Grunsky rgrunsky at sympatico.ca
Tue Oct 25 18:24:09 CEST 2016


I am trying to put together a short program to build a script file.

I declare the file as:

Uses sysutils;
{$H+I-}
Var
SFile : Text;

I then assign a name to the file :

Assign(SFile, SName);

Now, I only want to create the file if some conditions are met. Since 
this is in a loop I thought I could do this:

If (SFile.Mode = fmClosed) Then Rewrite(SFile);

But this line gives the error

Error: Illegal qualifier

and the location in the line is at the 'o' in Mode.

I vaguely remember doing things like this in Turbo/Borland Pascal many 
years ago. It should be possible to do this with Free Pascal?

I'm using
Free Pascal Compiler version 2.6.4 [2014/03/03] for x86_64 on Linux.

What am I doing wrong?

thanks
Rolf Grunsky
-- 
                                TRUTH in her dress finds facts too tight.
                                In fiction she moves with ease.
                                Stray Birds by Rabindranath Tagore



More information about the fpc-pascal mailing list