Sign in Join

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

Mailing lists / fpc-pascal / 2016-10

Test file mode question

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Rolf Grunsky

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