Sign in Join

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

Mailing lists / fpc-devel / 2002-02

can't get to console when using CRT unit

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Aleksey V. Vaneev

Hello,

This is not really a bug, but the default behaviour of CRT unit annoys me. It denies me of using "my.exe >out" constructs. In fact WriteLn output just doesn't writes anything in "out" file. What thing I could do with it? I have not found any specific switch to disable this behaviour.

Best regards,
Aleksey

Reply by email

Jonas Maebe
to Aleksey V. Vaneev
Aleksey V. Vaneev wrote 5 lines
This is not really a bug, but the default behaviour of CRT unit annoys me. It denies me of using "my.exe >out" constructs. In fact WriteLn output just doesn't writes anything in "out" file. What thing I could do with it? I have not found any specific switch to disable this behaviour.

The reason is that the crt unit takes over the output from the system to be able to use gotoxy etc. It simply writes a lot of escape/ansi sequences to the screen, which would show up as garbage when redirected to a file. It's as if you would want to redirect the output of pine to a file or so :)

If you want redirection, don't use the crt unit... If you want to 'turn off' the crt for a moment, use

assign(input,'');
reset(input);
assign(output,'');
rewrite(output);

To reactivate the crt unit, use

assigncrt(input);
reset(input);
assigncrt(output);
rewrite(output);

Jonas

Reply by email