home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20043 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.5 KB

  1. Xref: sparky comp.lang.c:20043 comp.os.msdos.programmer:12325
  2. Newsgroups: comp.lang.c,comp.os.msdos.programmer
  3. Path: sparky!uunet!munnari.oz.au!uniwa!cujo!cc.curtin.edu.au!tsuanian
  4. From: tsuanian@cc.curtin.edu.au
  5. Subject: Re: Reading the arrow keys... how?
  6. Message-ID: <1993Jan22.101809.1@cc.curtin.edu.au>
  7. Lines: 26
  8. Sender: news@cujo.curtin.edu.au (News Manager)
  9. Organization: Curtin University of Technology
  10. References: <1jmeupINN4g9@savoy.cc.williams.edu>
  11. Date: Fri, 22 Jan 1993 01:18:09 GMT
  12.  
  13. In article <1jmeupINN4g9@savoy.cc.williams.edu>, 93gke@williams.edu (Just Ask The Axis) writes:
  14. > I am trying to read the arrow keys from a PC keyboard in C. So far
  15. > the calls to getch(), getc(), getchar(), have been unsuccessful
  16. > because the keys don't seem to have a corresponding ASCII code (they
  17. > seem to send 2 characters..?) I also need to read some regular keys
  18. > like Q,S, etc... 
  19. > Could someone tell me how to read them directly, please.
  20. > Greg Ennis
  21. > 93gke@cs.williams.edu
  22.  
  23.  
  24. Keys such as arrow keys, function keys, etc do not have an ASCII
  25. code.  When one of these keys are pressed, it gives of two numbers.
  26. The first is 00 and the next is it's scan code. I think any decent
  27. MS DOS handbook should tell you what the scan codes are. but if
  28. you have any problems I'll see what I can dig up.
  29. Can't remember the exact code I used to read the codes, but I'm
  30. pretty sure it was a combination of kbhit() and getch().
  31.  
  32. Ian
  33. -- 
  34.  Internet: TSUANIAN@cc.curtin.edu.au
  35.  Bitnet: TSUANIAN%cc.curtin.edu.au@cunyvm.bitnet
  36.  UUCP  : uunet!munnari.oz!cc.curtin.edu.au!TSUANIAN
  37.