[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Standard file handles
0 Standard input device Stdin
1 Standard output device Stdout
2 Standard error device Stderr
3 Standard auxiliary device Stdaux
4 Standard printer device Stdprn
Stdin This is usually the keyboard, but it can be
redirected so that input is read from a file.
Stdout This is usually the display, but can be redirected
so the output is written to a file.
Stderr This is the display and cannot be redirected on the
command line. Stderr is useful for displaying error
or copyright messages that you don't want
Stdaux This is usually a serial device, and is the same as
the DOS `AUX:' device. You can both read from and
write to this device.
Stdprn This is usually the printer, and is the same as the
DOS `PRN:' device. You can both read from and write
to this device.
The file handles listed above are open when a program first starts.
You don't need to explicitly open any of these devices unless you had
previously closed one of these file handles.
Notes: All five predefined handles are in ASCII mode, which
means that DOS attaches special meaning to a number
of characters, including Ctrl-C (Ctrl-Break), Ctrl-
S, and Ctrl-P. In ASCII mode, Ctrl-Z is treated as
an end-of-file mark; characters read from Stdin are
echoed to the screen; control characters written to
Stdout and Stderr are displayed as a x sequence
(for example, D); and tabs are filled with spaces
to the next 8-character boundary.
You can change the mode of these devices between
ASCII and binary using the IOCTL calls (DOS function
44h). Note, however, that because the first three
devices (Stdin, Stdout, and Stderr) are all
duplicate handles, changing the mode on any one
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson