Saraf Aalhad Ashok wrote:

>  I can't locate a system call/library function equivalent to the kbhit()
> function provided on DOS platforms. Could you please tell me about such a
> function? I'm a novice when it comes to programming in C on the Linux
> platform.

Note that the Unix interactive I/O model is very different from that
for DOS. DOS assumes that you have a keyboard which is directly
attached to the computer. Unix assumes that you are using a terminal
which is connected via a serial line. Linux (and some other Unices)
use the keyboard and graphics card to emulate a number of serial
terminals.

Normally, the kernel delivers terminal input to a process one line at
a time. The input is only sent to the process when you press Return;
this allows the kernel to provide line editing (Backspace, Ctrl-W,
Ctrl-U) facilities.

If you wish to read characters as they are typed, you need to use put
the terminal into raw (non-canonical) mode. See the tcsetattr()
manpage (and see a book on Unix programming) for details.

Interactive programs are generally written using the curses (or
ncurses) library. See the ncurses manpage for details.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to