title: keyboad key codes table on Linux
body: <p>I'm learning C++.</p>
  
  <p>I'm testing how to which key has pressed the user. I have written this code:</p>
  
  <pre><code>#include &lt;signal.h&gt;
  #include &lt;termios.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  #define KEYCODE_L 0x44 // Left Arrow Key
  #define KEYCODE_R 0x43 // Right Arrow Key
  #define KEYCODE_U 0x41 // Up Arrow Key
  #define KEYCODE_D 0x42 // Down Arrow Key
  #define KEYCODE_Q 0x71 // Q Key
  
  int main(int argc, char **argv)
  {
    // get the console in raw mode
    tcgetattr(kfd, &amp;cooked);
    memcpy(&amp;raw, &amp;cooked, sizeof(struct termios));
    raw.c_lflag &amp;= ~(ICANON | ECHO);
  
    // Setting a new line, then end of file
    raw.c_cc[VEOL] = 1;
    raw.c_cc[VEOF] = 2;
    tcsetattr(kfd, TCSANOW, &amp;raw);
  
    puts("Reading from keyboard");
    puts("---------------------------");
    puts("Use arrow keys to move the robot.");
  
    // get the next event from the keyboard
    if (read(kfd, &amp;c, 1) &lt; 0)
    {
      perror("read():");
       /**
       * Reset console to its original mode.
       */
       tcsetattr(kfd, TCSANOW, &amp;cooked);
       exit(-1);
    }
  
    switch (c)
    {
     case KEYCODE_R:
       std::cout &lt;&lt; "Right Arrow" &lt;&lt; std::endl;
        break;
     case KEYCODE_L:
       std::cout &lt;&lt; "Left Arrow" &lt;&lt; std::endl;
        break;
      case KEYCODE_U:
       std::cout &lt;&lt; "Up Arrow" &lt;&lt; std::endl;
        break;
      case KEYCODE_D:
       std::cout &lt;&lt; "Down Arrow" &lt;&lt; std::endl;
        break;
    }
  }
  </code></pre>
  
  <p>Where can I find a table for all of those values that I have called KEYCODE_?</p>
  
  <p>I’m looking for a table with the values for all the keys. I have found a JavaScript table but the values doesn't match.</p>