From owner-freebsd-chat Thu Jun 13 14:51:39 1996 Return-Path: owner-chat Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA20735 for chat-outgoing; Thu, 13 Jun 1996 14:51:39 -0700 (PDT) Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id OAA20711 for ; Thu, 13 Jun 1996 14:51:29 -0700 (PDT) Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id XAA23218; Thu, 13 Jun 1996 23:51:02 +0200 Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id XAA16996; Thu, 13 Jun 1996 23:51:01 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.7.5/8.6.9) id XAA15302; Thu, 13 Jun 1996 23:28:38 +0200 (MET DST) From: J Wunsch Message-Id: <199606132128.XAA15302@uriah.heep.sax.de> Subject: Re: Any alternatives for kbhit() and getch To: freebsd-chat@freebsd.org Date: Thu, 13 Jun 1996 23:28:38 +0200 (MET DST) Cc: jsigmon@www.hsc.wvu.edu Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <31BF97BC.5E2D@access.mountain.net> from Jeremy Sigmon at "Jun 12, 96 09:23:24 pm" X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E X-Mailer: ELM [version 2.4ME+ PL17 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-chat@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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. ;-)