code_junkie

How can I capture single keystrokes in a unix console app without blocking?

Nov 11th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.09 KB | None | 0 0
  1. if( kbhit() ) {
  2. char c = getch();
  3. if( c == 'q' ) break;
  4. }
  5.  
  6. read( f, &c, 1 )
Add Comment
Please, Sign In to add comment