create new tag
, view all tags

Some simple programs in C.




Detecting ASCII Key Codes

from Linux Backspace/Delete mini-HOWTO:

The following C one-liner

void main(void) {int c; while(c = getchar()) printf("%d 0x%02X\n", c, c);}

may help you. Put the line into a file named ascii.c, compile it with gcc ascii.c -o ascii, type ./ascii and press a key followed by RETURN. The program will display the decimal and hexadecimal codes of the ASCII sequence produced (you may want to do a stty erase ^- first to get really all the codes). Now you can easily see what Backspace key does: if it emits a DEL (127), you have a standard emulator, if it emits a BS (8) you have a deviant one.


  • () RandyKramer - 14 Apr 2003
  • If you edit this page: add your name here; move this to the next line; and include your comment marker (initials), if you have created one, in parenthesis before your WikiName.

Page Ratings

Topic revision: r1 - 2003-04-14 - RandyKramer
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look