Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jun 1996 23:28:38 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-chat@freebsd.org
Cc:        jsigmon@www.hsc.wvu.edu
Subject:   Re: Any alternatives for kbhit() and getch
Message-ID:  <199606132128.XAA15302@uriah.heep.sax.de>
In-Reply-To: <31BF97BC.5E2D@access.mountain.net> from Jeremy Sigmon at "Jun 12, 96 09:23:24 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
As Jeremy Sigmon wrote:

> I am writing a timed program.  I need to be checking the
> time while waiting for input.  This is to be written as much as
> possible in ANSI C.

It's impossible in ANSI C (kbhit() ain't ANSI either).

For the Unix environment, use select(2).  It also handles the timing
for you.  You might need to turn the terminal into ``raw'' mode as
well, otherwise all input processing will be handled in terms of lines.
RTFM termios(7) for this.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606132128.XAA15302>