Message-Id: <3.0.16.19971017112235.34df9b96@hem1.passagen.se> Date: Fri, 17 Oct 1997 11:23:23 -0400 To: "Ingo Ruhnke" From: Peter Palotas Subject: Re: problem with readkey() Cc: djgpp AT delorie DOT com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk At 19.21 1997-10-16 GMT, you wrote: >I got here some simple code which dosen't run as I expect it to work: > >#include >#include > >void main() >{ > allegro_init(); > install_keyboard(); > > if (readkey() == 'a') { > printf ("a was pressed"); > } else { > printf ("a wasn't pressed"); > } >} Well, the "problem" here is that readkey() returns an integer with information in the lower 16-bits. The high byte of this contains the scancode, i.e. ESC = 1 and so on. The low byte contains the Ascii character, so converting this to a char is neccessary if you just want the character. This is covered in the docs too AFAIK, read them! :) -- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se -- ***************************************************** * A brief description of DJGPP: * * NEVER BEFORE HAS SO FEW DONE SO MUCH FOR SO MANY! * *****************************************************