[fpc-pascal]input, output

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Thu Jul 19 00:04:40 CEST 2001


On Wed, 18 Jul 2001 Zlatko.Petrin at allzool.bio.uni-giessen.de wrote:

> Dear ladies and gentlemen,
>
> I have tried to change the standard in- and output files in an
> exercice-program all day, but did not succeed.
>
> I know that this has to be done in the case of Turbo-PASCAL for
> instance in the following way:
> ...
> assign ( input , 'test.dat' ) ;
> reset ( input ) ;
> ...
> However, it does not work when using the Free-PASCAL-Compiler.

It works absolutely fine here, BUT you must close the input and output
first:
----------------------------------------------------------------------
program test;

Var
  S : String;

begin
  Close(input);
  Assign(Input,'test.pp');
  Reset(Input);
  While not eof(input) do
    begin
    ReadLn(Input,s);
    Writeln(S);
    end;
  Close(input);
end.
-----------------------------

Save as test.pp and (if under linux) run as ./test

Michael.


Michael.





More information about the fpc-pascal mailing list