17.2 About the Console

The console provides input and output to character-based applications. The console displays output in a console window that acts like a terminal display. The system creates the console window and provides the input and output to the program just as if it were running in a full-screen session.

A console, consisting of an input buffer and one or more screen buffers, is shared by a group of processes. It is first created when an application without a parent application , such as CMD.EXE, is started. It is also possible for a detached process to create a console. Handles to Standard Input, Standard Output, and Standard Error files are created and are inherited by child processes. An application can get console input by reading from the input buffer which is referred to as “CONIN$”. StdIn is a handle to “CONIN$”. An application can write to a console by writing to a console screen buffer. StdOut and StdErr are handles to console screen buffers. The active screen buffer is referred to as “CONOUT$”.