Quote Originally Posted by fahadmunir32 View Post
Here is a simple example to detecting a keypress in c++ using while loop and getch() hope it may be helpfull.
This uses the conio library which the OP didn't want to use as this is for windows whereas a Ubuntu solution was needed.