How to un-AssignCrt(Output)?

crt, delphi, pascal, turbo-pascal

Solution

The `Crt` textfile driver does not support the `tab` character in `turbo-pascal`. To revert back the standard `dos` driver, do as follows:

Assign(Output,''); // Restores standard dos output

You can later reinstate the Crt driver by:

AssignCrt(Output);

Problem

In TurboPascal program i took an advantage of DOS processed output and use Tab control character to form columns in the output: ``` const Tab = #09; ... Writeln(X, Tab, F(X)); ``` However, when i tried to add a `pause`-like functionality via `ReadKey` call and used `Crt` module, processed output broke, and the statement illustrated above began writing generic Tab glyph instead forming columns at the tab stops. As i figured out, source of this phenomenon is `AssignCrt(Output)` call at the module initialization, which redefines means how `Writeln` works - it no longer uses DOS for output, but either video BIOS or direct video memory access (depending on `DirectVideo` value) instead. How do i reverse whatever `AssignCrt` does? As far as i know from the documentation, there `Crt` module provides no means to restore normal output.

Original source