keypressed()

David Keppel pardo at june.cs.washington.edu
Thu Feb 18 07:41:37 AEST 1988


In article <136 at forty2.UUCP> eschle at forty2.UUCP (Patrik Eschle) writes:
[ how to do "char=keypressed()" returns 0 if none pressed? ]
>I can't use curses and have played around with ioctl, but its
>really slow.

(Everybody: please include a return address.  I don't have domain uucp!)

On BSD Un*x you can use the "select()" call to wait for a stream to become
ready; if the "timeout" parameter is zero (NOT a zero pointer!) the call
will return immediately.  I have no idea what the performance is compared
to ioctl(), I'd guess it is less device-dependent than ioctl().

On some (many?) PCs, you can read the keyboard or controller directly.

    ;-D on  (Not an answer, but at least not a question!)  Pardo



More information about the Comp.lang.c mailing list