title: Getting raw input from console using C or C++
body: <pre><code>/* Initialize new terminal i/o settings */
  static struct termios old, new1;
  void initTermios(int echo) {
      tcgetattr(0, &amp;old); /* grab old terminal i/o settings */
      new1 = old; /* make new settings same as old settings */
      new1.c_lflag &amp;= ~ICANON; /* disable buffered i/o */
      new1.c_lflag &amp;= echo ? ECHO : ~ECHO; /* set echo mode */
      tcsetattr(0, TCSANOW, &amp;new1); /* use these new terminal i/o settings now */
  }
  
  /* Restore old terminal i/o settings */
  void resetTermios(void) {
      tcsetattr(0, TCSANOW, &amp;old);
  }
  </code></pre>
  
  <p>How can I get arrow key as input (possibly as a single character), the current code works good for all other things I need... Please no solution with <b>ncurses</b></p>