getch and arrow codes

By pressing one arrow key getch will push three values into the buffer: ‘\033’ ‘[‘ ‘A’, ‘B’, ‘C’ or ‘D’ So the code will be something like this: if (getch() == ‘\033’) { // if the first value is esc getch(); // skip the [ switch(getch()) { // the real value case ‘A’: // code … Read more