www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/26/21:52:17

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199607270147.AA080982049@relay1.geis.com>
Date: Sat, 27 Jul 96 01:23:00 UTC 0000
To: bluestar AT dominet2 DOT in DOT com DOT tr
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: C question

Reply to message 2035076    from BLUESTAR AT DOMI on 07/26/96  6:42AM


>How can I check the keyboard buffer to see if there is someething waiting
>and if its an direction key how can I dertermine which one is it ??
>I use kbhit and getch but after getch I only get 0 ??
>
>How can I determine the key

This is hardly a DJGPP specific question; any decent C text or teacher
can tell you about extended key codes.  Anyway, when you press a
key that doesn't have an ANSI code (like an arrow key, function key,
Alt-key, etc.), the BIOS first returns a null character (0) to signify an
extended key, and then returns the actual extended keycode.  You
have to have your program recognize this and call getch() a second
time.

For a list of extended keycodes, see any competent programming
book.  It doesn't even have to be for C; every language uses them.

John

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019