1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Are there keys that don't return ASCII codes?

  1. Mar 23, 2013 #1

    JJBladester

    User Avatar
    Gold Member

    1. The problem statement, all variables and given/known data

    Give an example of a key that does not return an ASCII code.

    3. The attempt at a solution

    I looked at the extended ASCII table on www.ascii-code.com and found that there are several "control characters" which do not return a printable character. It seems pretty obvious that the escape key does not print a character, for example. However, it still returns code 1B (hex). I cannot imagine why there would be a key that would not return an ASCII code, and if so which key(s) that/they would be.
     
  2. jcsd
  3. Mar 23, 2013 #2

    trollcast

    User Avatar
    Gold Member

    Think about the keys on your keyboard that modify the input or do something but don't actually produce characters on their own.
     
  4. Mar 23, 2013 #3

    JJBladester

    User Avatar
    Gold Member

    I see where you are going with this (CTRL, ALT, Shift, etc.).

    However, the escape key doesn't produce characters on the screen although it still has a hex code associated with it and it still can be read by certain interrupts like INT 16H. So, I am inclined to say it *does* return an ASCII code even though it is not displayed on the screen.
     
  5. Mar 23, 2013 #4

    trollcast

    User Avatar
    Gold Member

    The key / scan code is different to the ASCII code.

    The key code tells the computer which key has been pressed, the os converts these into either values such as ascii codes or it will do something, eg. pressing the windows key will open the start menu, cap lock toggles the value the alphabet keys take, etc.

    (The scan / key code tells which one of the keys on the keyboard has been pressed but not what it actually means so number 17 which is q on an english QWERTY keyboard would return a on a french AZERTY keyboard)
     
  6. Mar 24, 2013 #5

    JJBladester

    User Avatar
    Gold Member

    Thanks for clarifying about the scan codes vs. ASCII codes.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Are there keys that don't return ASCII codes?
Loading...