Sign in Join

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

Mailing lists / fpc-pascal / 2001-07

input, output

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Unknown author

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 does even not work when using the MS-PASCAL-Syntax. And, unfortunately, I was not able to work out the correct syntax by studying the documentation.

Would you please give me a hint? (German or English)

Yours sincerely,
Zlatko Petrin

PS: I am not subscribed to any mailing list!!!

Reply by email

Unknown author
to Unknown author
Show quoted text 12 lines
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.

Reply by email