Date: Wed, 7 May 2008 20:06:31 +0100 From: David Malone <dwmalone@maths.tcd.ie> To: rmgls@free.fr Cc: freebsd-hackers@freebsd.org Subject: Re: general i/o question Message-ID: <20080507190631.GA90936@walton.maths.tcd.ie> In-Reply-To: <20080507153903.41F6C322858@smtp7-g19.free.fr> References: <20080507153903.41F6C322858@smtp7-g19.free.fr>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 07, 2008 at 05:39:00PM +0200, rmgls@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. David.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080507190631.GA90936>