Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!pilchuck!dataio!gtenmc!ravim From: ravim@gtenmc.UUCP (ravim) Newsgroups: comp.lang.c Subject: Re: Trouble with curses Message-ID: <930@gtenmc.UUCP> Date: 29 Oct 90 18:55:44 GMT References: <1990Oct27.173826.29771@NCoast.ORG> Reply-To: ravim@gtenmc.UUCP (Ravi Kumar Mandava) Distribution: usa Organization: GTE Telecom, Inc. Bothell, WA Lines: 55 In article <1990Oct27.173826.29771@NCoast.ORG> ramsey@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 >#include >#include > > 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@CLEVELAND.FREENET.EDU , > >Thankyou. Good luck. - Ravi Mandava -- ********************** #include ************************** Ravi Mandava e-mail : ravim@gtenmc.gtetele.com or ravim@gtenmc.UUCP *******************************************************************************