Files: the solution

Tue, 28 Nov 1995 14:38:06 +0100 (MEZ)


Hello!  I have solved the file problem.

It is in fact a bug in GPC 2.6.3:  The bind procedure does not add
a null character to the filename string when passing it to C.  But
no problem: we can correct it manually.  (Since often there is a
null character in RAM following the string by random, the error
was not always reproducible.)

The following modified Assign procedure does work around the bug
and has been proven to work with GPC:


Procedure Assign ( Var T: Text; protected Name: String );

Var
  B: BindingType;

begin (* Assign *)
  unbind ( T );
  B:= binding ( T );
  B.Name:= Name + chr ( 0 );  (* add the null character manually *)
  bind ( T, B );
  B:= binding ( T );
end (* Assign *);


According to Berend de Boer:
> 
> Peter Gerwinski wrote in a message to Berend de Boer:
> 
> PG> I tried to use Extended Pascal "binding" to assign a file
> PG> variable to an external -- existing -- file.  I just copied
> PG> the "Assign" pro- cedure by Berend as published in
> PG> borland2ep.doc.  It does not always work: I often get a
> PG> runtime error saying that the file did not exist.
> 
> If you can repeat it, compile with another Extended Pascal compiler, for example Prospero's one. If that fails too, there is really something wrong with the code. But I suspect gpc. You're using which OS?

I am using Linux, OS/2 and (Novell) DOS.

I have never seen a compiler for Extended Pascal ... is Prospero's one
FreeWare?  Where can I find it?

Greetings,

    Peter

--------------------------------------------------------------------------------
Dipl. Phys. Peter Gerwinski
Fachbereich Physik
Universitaet-GH Essen                   Phone:  +49-201-183-2763
D-45117 Essen                           Fax:    +49-201-183-2120
Germany                                 e-mail: pege@mail.theo-phys.uni-essen.de
--------------------------------------------------------------------------------


Peter Gerwinski (pege@rs1.Theo-Phys.Uni-Essen.DE)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es