From: George Foot Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro: reading input and comparing with switch Date: 21 Nov 1997 05:00:20 GMT Organization: Oxford University, England Lines: 20 Message-ID: <6534h4$qu0$2@news.ox.ac.uk> References: <3474CB66 DOT BBF414A5 AT primenet DOT com> NNTP-Posting-Host: sable.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On 20 Nov 1997 16:43:00 -0700 in comp.os.msdos.djgpp Mike McLean wrote: : I have functions that read in input using allegro's readkey command, and : I have that character or letter checked by a switch statement. The : Problem is sometimes it takes 2 or 3 times hitting the key to get it to : read it. I'm stuck here. Please help me out. You're calling readkey twice! When you write: : readkey(); : switch(readkey() & 0xff) ... it calls readkey(), which waits for a key to be pressed, and discards the value returned. Then it calls readkey() again, which waits for another keypress, and uses that value to index the switch statement. You need to get rid of the first readkey, perhaps. -- george DOT foot AT merton DOT oxford DOT ac DOT uk