Mail Archives: djgpp/1997/11/21/18:01:39
George Foot wrote:
>
> On 20 Nov 1997 16:43:00 -0700 in comp.os.msdos.djgpp Mike McLean <libolt AT primenet DOT com> 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
I figured this out late last night :) Thanks for the help.
- Raw text -