How can I exit from an infinite loop, when a key is pressed? Currently I\'m using getch, but it will start blocking my loop as soon, as there is no more input to read.
I would suggest that you go throgh this article.
Non-blocking user input in loop without ncurses.