general i/o question
dwmalone at maths.tcd.ie
Wed May 7 19:06:34 UTC 2008
On Wed, May 07, 2008 at 05:39:00PM +0200, rmgls at free.fr wrote:
> i need to test (NOWAIT), the presence of keypressed/depressed on a terminal
> and then read the scan code, like for a piano pc keyboard.
> my questions are as follows:
> 1. is it a general C function which may scan a terminal without waiting?
There isn't a general way of doing this, as even if there is a
terminal attached, the terminal may actaully be an ssh session, and
which does not transmit key up/down events. If you look at the Unix
TTY stuff, you can get the stream of keys pressed, but this may not
be enough for a piano type application.
If you're only targeting the FreeBSD console there may be other
options, but it will be more specific that TTY calls. If you are
trageting X11, then it does support key up/down events and a book
or tutorial on X programming should help.
More information about the freebsd-hackers