Trouble with curses
ravim
ravim at gtenmc.UUCP
Tue Oct 30 05:55:44 AEST 1990
In article <1990Oct27.173826.29771 at NCoast.ORG> ramsey at NCoast.ORG (Cedric Ramsey) writes:
>
>Hi, this is Connie. I'm accessing this net with a friends account.
>I have a question about the curses package. Heres the skeletal code:
>
>#include <stdio.h>
>#include <curses.h>
>#include <term.h>
>
> ch = getch();
> switch(ch) {
> case 27: /* escape */
> do_escape();
> break;
> [ ... irrelevant stuff deleted ... ]
> }
> }
>}
>
>do_escape() {
> switch(tolower(getch())) {
If 'tolower' routine is a macro (defined in 'ctype.h') that evaluates
its argument twice, then this could be the cause for your problem of
having to press 'E' twice.
One solution is :-
do_escape() {
register char c;
c = getch();
switch(tolower(c)) {
case 'e':
....
>Basically what is happening is the the user presses ESCAPE key follow by
>'E' key to exit. But I have to press 'E' twice after pressing ESCAPE
>to get an exit. I can't figure out why. Does anybody know ?
>
>I would prefer a post to net but if you must send mail please do not
>send it to this box instead send it to me at aj398 at CLEVELAND.FREENET.EDU ,
>
>Thankyou.
Good luck.
- Ravi Mandava
--
********************** #include <stddisclaimer.h> **************************
Ravi Mandava e-mail : ravim at gtenmc.gtetele.com
or ravim at gtenmc.UUCP
*******************************************************************************
More information about the Comp.lang.c
mailing list