[fpc-devel]can't get to console when using CRT unit

Jonas Maebe jonas at zeus.rug.ac.be
Fri Feb 15 21:36:38 CET 2002


On Thu, 14 Feb 2002, Aleksey V. Vaneev wrote:

>   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





More information about the fpc-devel mailing list