From: Zeyd M. Ben-Halim (zmbenhal@netcom.com)
Date: 08/17/93


From: zmbenhal@netcom.com (Zeyd M. Ben-Halim)
Subject: Re: Ncurses, how do I...
Date: Tue, 17 Aug 1993 19:47:18 GMT

In article <60.41137.2707.0N1815E2@canrem.com> jason.siemens@canrem.com (Jason Siemens) writes:
>-> I am trying to do some C programming under Linux. I am having
>-> trouble with a particular routine I am pretty sure it's in the
>-> ncurses library. What am I trying to do is the following.
>->
>-> Print some text, then have the user input *1* character of
>-> information. getchar() only works if you hit carriage return. I want
>-> the user to just hit one key on the keyboard and then have that
>-> keystroke returned to the calling part of the program. Sort of like
>-> an inkey function in BASIC.
>->
>-> My C is a little rusty, so please email me with any info to help
>-> solve this problem. I am also then interested to see what command
>-> syntax I need to use to cc (what -l options do I need to use?)
>->
>-> Thanks,
>-> Fozzie
>
>Try :
> int key;
> while (!kbhit()) {};

There s no kbhit(), you need to call cbreak() before you call getch() this
will return single keystrokes.

> key = getch();
>
>I not sure whether you have kbhit() and getch() but there should be some
>other similiar functions. I am using Borland C++ 3.1 for DOS but these
>functions are usually standard. I have them in STDIO.H and CONIO.H.

Anything in conio.h is NOT standard (MSDOS specific).

>Hope this helps,
>
>Jason Siemens.
>jason.siemens@canrem.com

Zeyd