
EXAMPLE: PRINTING AND PROMPTING
39
d etaches a process from its console. Calling
then creates a new one associated with the process’s standa rd input, output, and
error handles.
will fail if the process already has a console; to
avoid this problem, precede the call with
.
Note: Windows GUI a pplications do not have a default console and must
allocate one before using functions such as
or to display
on a console. It’s also possible that server processes may not have a console.
Chapter 6 shows how a process can be crea ted without a console.
There are numerous other console I/O functi ons for specifying cursor position,
screen attributes (such as color), ...