From owner-freebsd-chat Wed Jun 12 19:09:47 1996 Return-Path: owner-chat Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id TAA21675 for chat-outgoing; Wed, 12 Jun 1996 19:09:47 -0700 (PDT) Received: from Access.Mountain.Net (root@Access.Mountain.Net [198.77.1.3]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id TAA21668 for ; Wed, 12 Jun 1996 19:09:41 -0700 (PDT) Received: from Slip22-14.Mountain.Net (Slip22-14.Mountain.Net [198.77.1.166]) by Access.Mountain.Net (8.6.12/8.6.9) with SMTP id WAA29991 for ; Wed, 12 Jun 1996 22:09:28 -0400 Message-ID: <31BF97BC.5E2D@access.mountain.net> Date: Wed, 12 Jun 1996 21:23:24 -0700 From: Jeremy Sigmon Reply-To: jsigmon@www.hsc.wvu.edu Organization: WVU Graduate Student X-Mailer: Mozilla 2.0 (Win16; I) MIME-Version: 1.0 To: freebsd-chat@freebsd.org Subject: Any alternatives for kbhit() and getch Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline Sender: owner-chat@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Path: news.mountain.net!usenet From: Jeremy Sigmon Newsgroups: comp.unix.programmer Subject: Any alternatives for kbhit() and getch Date: Wed, 12 Jun 1996 20:47:11 -0700 Organization: WVU Graduate Student Lines: 19 Message-ID: <31BF8F3F.2052@access.mountain.net> NNTP-Posting-Host: slip22-14.mountain.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 2.0 (Win16; I) 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. With DOS(gak) I would use: while(!kbhit()); char_input = getch(); But kbhit isn't available and the getch() routines in curses have some very funny properties. For instance a CR isn't counted as a character for the above routine and such.... Are there any implementations of these two functions for UNIX? Or any suggestions using other functions? thanks Please reply by EMail because I only check this once per week.