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