From: zmbenhal@netcom.com (Zeyd M. Ben-Halim) Subject: Re: Ncurses, how do I... Date: Sat, 14 Aug 1993 20:34:53 GMT
In article <1993Aug14.125802.5608@turtle.apana.org.au> fozzie@turtle.apana.org.au (Fozzie Bear) 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.
That is NORMAL behavior (see manual.doc). By default input is in cooked mode,
which means it waits for a whole line terminated by <enter> and allows you
to erase characters, etc.
There are two alternative modes:
cbreak() which will allow you to read one character at a time, and
raw() which is the same but you can't use signals (^c, ~z, etc) you have to
trap them yourself).
Zeyd
>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
>
>--
>-------------------------------------------------------------------------------
>fozzie@turtle.apana.org.au I'm looking for an ascii turtle picture.
> If you've got one, email it to me!