[fpc-pascal] SinclairQL (M68K) Port

Norman Dunbar Norman at dunbar-it.co.uk
Mon Mar 22 15:00:58 CET 2021


Replying to self here...

On 22/03/2021 11:33, Norman Dunbar via fpc-pascal wrote:

> I have a minimum test harness for it at the moment that I'm attempting 
> to sort out.
> 
> Var F : Text;
> 
> begin
>    Assign(F,'ram1_test.txt');
>    Rewrite(F);
>    Writeln(F,'Try and find this when I''m finished !');
>    Close(F);
> end.
> 
> I've tested with just the assign and rewrite, seems to have had no 
> effect - the output file, which has some text in it, remained untouched. 
> Adding in the writeln call causes runtime error 103. Which I believe is 
> "file not open".

Ok, I've found and fixed that problem. It was related to this FIXME left 
in the code:

{ rewrite (create a new file) }
   { FIX ME: this will just create a new file, actual overwriting
     seems to be a more complex endeavor... }
   if (flags and $1000)<>0 then openMode:=Q_OPEN_NEW;

   res:=io_open(p,openMode);

It was a simple change, Use Q_OPEN_OVER instead of Q_OPEN_NEW as the 
latter barfs with an "already exists" error if the file is there. The 
Q_OPEN_OVER will overwrite any existing file or create a new file, as 
required.

My testing of rewrite is now finished and working. So far anyway!



Cheers,
Norm.

-- 
Norman Dunbar
Dunbar IT Consultants Ltd

Registered address:
27a Lidget Hill
Pudsey
West Yorkshire
United Kingdom
LS28 7LG

Company Number: 05132767


More information about the fpc-pascal mailing list