How to un-AssignCrt(Output)?
Asked Answered
E

1

5

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.

Extenuatory answered 11/6, 2012 at 16:58 Comment(0)
M
9

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);

Miler answered 11/6, 2012 at 17:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.