Printing while reading characters in C
问题 I'm trying to write a simple little snippet of code to respond to an arrow key press. I know that up is represented by ^[[A, and I have the following code that checks for that sequence: while( 1 ) { input_char = fgetc( stdin ); if( input_char == EOF || input_char == '\n' ) { break; } /* Escape sequence */ if( input_char == 27 ) { input_char = getc( stdin ); if( input_char == '[' ) { switch( getc( stdin ) ) { case 'A': printf("Move up\n"); break; } } } } Whenever I hit "up", the escape