17.3.3 Modes for the File Functions

For the File functions, the relevant input modes are line input, processed input and echo. All input handles are created with these three modes enabled by default. The following table lists the effects of these input modes:

line In line mode, ReadFile does not return to the caller until the Enter key is pressed. If disabled, ReadFile returns when one or more characters are available in the input buffer; and the only key combination not passed on to the caller is Ctrl-Break.
processed Any system editing or control keys are processed by the system and are not passed on to the user. If line input is also enabled, tab, backspace, carriage returns, and bell will be handled correctly. Tabs cause the cursor to move to the next tab stop, which occurs every 8 characters. Backspace causes the cursor to move back one space without affecting the character at the cursor position. Bell causes a short tone to be sounded. Carriage returns are converted to carriage return/linefeed. Ctrl-C and Ctrl-Break will be passed on to the appropriate handler regardless of whether line input is enabled. This mode affects the buffer that is returned by ReadFile. If echoing is enabled and you want the output to reflect the system editing, processed output must be enabled for the output handle.
echo If echo is enabled in conjunction with line input mode, characters are echoed to the screen as they are read by ReadFile. Characters are echoed only if the ReadFile caller has an open handle to the active screen buffer. Echo mode may not be used with character input mode.

For the File functions, the relevant output modes are processed output and wrap at EOL, both of which are enabled by default. Applications using the Console functions are not affected by either of the output modes.

processed If processed output is enabled, the characters written by WriteFile or echoed by ReadFile are parsed for ASCII control sequences and the correct action is performed. This is equivalent to the processed input mode, except that it affects the characters written to the screen buffer.
wrap at EOL If wrap at EOL is enabled, the current output position (cursor position) moves to the first column in the next row when the end of the current row is reached. If the bottom of the window region is reached, the window origin is moved down one row. This has the effect of scrolling the contents of the window up one row. If the bottom of the screen buffer is reached, the contents of the screen buffer are scrolled up one row, discarding the top row of the screen buffer. If wrap at EOL is disabled, the last character in the row is overwritten with any subsequent characters. The effects of wrap or no wrap occur when the application calls WriteFile with a handle to the active screen buffer or when output is echoed during a call to ReadFile.

Typically, applications using the File functions will choose to either enable or disable all of the above modes as a group. When all are enabled, you are in “cooked” mode, where most of the processing is handled for you. And when all are disabled, you are in “raw” mode, in which case, the input is unfiltered and the processing is up to you. By default, all input and output handles initially have all of the above modes enabled.