home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!munnari.oz.au!newsroom.utas.edu.au!sol!quan
- From: quan@sol.surv.utas.edu.au (Stephen Quan)
- Subject: Re: Unix equivalent to DOS kbhit() function?
- Message-ID: <quan.726301609@sol>
- Sender: news@newsroom.utas.edu.au
- Organization: University of Tasmania, Australia.
- References: <1992Dec29.073337.2693@kum.kaist.ac.kr>
- Date: Wed, 6 Jan 1993 06:26:49 GMT
- Lines: 24
-
- typhoon@stcon2.kaist.ac.kr (Han Yun-Su) writes:
- >I wrote 'kbhit()' function for UNIX.
- >It's very simple..
-
- [...rest of C program omitted...]
-
- > while (c != 'q') {
- > count++;
- > if (kbhit()) {
- > c = getch();
- > mvprintw(1, 0, "%d: \'%c\' is pressed (count: %ld)\n", ++i, c, count);
- > refresh();
- > }
- > }
-
- If your UNIX platform is like ours, I recommend you put a some kind of
- delay in your while loop, [or perhaps in the kbhit() function] otherwise
- your process may use large amounts of CPU time. Otherwise not a bad
- program for a Life Science Major!
- --
- Stephen Quan (quan@sol.surv.utas.edu.au) Tel : 002 202844 (local)
- Research Fellow, Computer Scientist, Fax : 002 240282 (local)
- Centre for Spatial Information Systems, Tel : 61 02 202844
- University of Tasmania, Australia. Fax : 61 02 240282
-