Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
AssignCrt Procedure
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
file_variable File of type text
Description
The AssignCrt procedure associates a file variable of type text
with the console. After a successful assignment and subsequent call
to Reset or Rewrite, all operations directed to file_variable
act directly on the CRT monitor. This gives an advantage in speed.
Use AssignCrt to associate I/O with the console when standard I/O is
being redirected to a file or to get faster output to the screen.
Use AssignCrt to associate either input or output with the console
when the standard file Input or Output has been redirected to a
file. When the Crt unit is used, it assigns I/O to the Crt and
removes the ability to redirect I/O with the DOS redirection
operators (<) and (>). However, if redirection of input is
reenabled (by calling the Assign procedure), no input can come from
the keyboard. Likewise, if output is redirected, no output goes to
the screen. AssignCrt can reenable either input from the keyboard
or output to the screen:
To read from the keyboard while input is redirected from a
file, call AssignCrt and Reset for file_variable. Then Read
from file_variable.
To write to the screen while output is redirected to a file,
call AssignCrt and Rewrite for file_variable. Then Write to
file_variable.
Use AssignCrt to get faster output to the screen. If output has not
been redirected, standard output is the CRT. Write and Writeln send
text to the screen. AssignCrt in this situation gives an advantage
of speed. The Crt unit's direct-video routines are fast because
they bypass DOS and deal directly with the BIOS or the CRT
controller. The disadvantage of using AssignCrt is some loss of
portability.
If AssignCrt is passed a file_variable already associated with an
open file, the previous file assignment is lost.