1
1
10101010010001001101001112013-04-09 19:18:06
DOS
1010101001000100110100111, 2013-04-09 19:18:06

How to output data to STDERR stream from Turbo Pascal 7.0/7.1 program?

In Turbo Pascal, two standard streams are available to the program: <STDIN> in a variable of type text Input and <STDOUT> in Output .

Please tell me how to open the <STDERR> error stream for writing using standard language tools (even with crutches, for example, assembler inserts, interrupts, DOS and BIOS function calls).

Answer the question

In order to leave comments, you need to log in

5 answer(s)
I
Ivan, 2013-04-09
@iSage

www.macgui.com/usenet/?group=107&id=6350#msg

W
wwi, 2013-04-09
@wwi

MS Dos, classic
echo "Error" 2 > errorfile.log
file #2

A
alexhemp, 2013-04-10
@alexhemp

I haven't picked up Turbo Pascal for a long time, about 15 years :)
Try something like this:

program Demo;
uses
  Dos;
var
  StdErr: Text;
begin
  Assign(StdErr, '');
  Rewrite(StdErr);
  TextRec(StdErr).Handle:=2;

  Writeln('Standard output');
  Writeln(StdErr, 'Standard error');

  Close(StdErr);
end.


Well, in unit, if it works

A
alexhemp, 2013-04-10
@alexhemp

Also, look at the sources of the Dos module (like Turbo Pascal should also be the source of standard modules) - maybe there already is a variable like ErrOutput

A
alexhemp, 2013-04-10
@alexhemp

I found the sources of Borland Pascal 7.0 - there Input and Output are defined in system.pas and there is nothing with stderr :(

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question