How can I read a single character from the keyboard without waiting for the RETURN key? How can I stop characters from being echoed on the screen as they e typed?
Alas, there is no standard or portable way to do these things in C. Concepts such as screens and keyboards are not even mentioned in the Standard, which deals only with simple I/O “streams” of characters. Input to a computer program typically passes through several stages. At the lowest level, device-dependent routines within the operating system handle the details of interfacing with particular devices such as keyboards, serial lines, disk drives, etc. Above that, modern operating systems tend to have a device-independent I/O layer, unifying access to any file or device. Finally, a C program is usually insulated from the operating system’s I/O facilities by the portable functions of the stdio library. At some level, interactive keyboard input is usually collected and presented to the requesting program a line at a time. This gives the operating system a chance to support input line editing (backspace/delete/rubout, etc.) in a consistent way, without requiring that it be built into e
Related Questions
- How can I read input from the keyboard without waiting for the return key to be pressed? How can I animate some display so that the timings will be the same on different computers?
- How can I read a single character from the keyboard without waiting for the RETURN key? How can I stop characters from being echoed on the screen as they e typed?
- How can I read a single character from the keyboard without waiting for the RETURN key?