TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Fitzsimmons
from: Henk den Adel
date: 1995-06-15 22:12:14
subject: Screen Writes

Hi Peter,

 Peter Fitzsimmons wrote to Simeon Cran:

 PF> There is rarely a need to call a kbd function directly;  simply use
 PF> getch() and kbhit().

How do I distinguish between a 9 from the top of the keyboard and a 9 of
the numeric keyboard using getch()? The scan codes make the difference (0A
and 49) but are invisible using getch()?

#include 
#include 
#include 

main()
{
   char c;

   while ((c=getch()) != (char) 27 )
      printf("It was %d\n", (int) c);

   return 0;
}

It was 57
It was 57


73 es cuagn,
 Henk

--- The-Box Point 0.15+ PC
* Origin: I like OS/2 2.1 GA stability (2:286/401.26)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 286/4 10 280/801 283/512 396/1 270/101 105/103 42 712/515 711/808 809
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.