C exit from infinite loop on keypress

前端 未结 5 982
囚心锁ツ
囚心锁ツ 2020-12-10 05:47

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.

5条回答
  •  臣服心动
    2020-12-10 06:19

    I would suggest that you go throgh this article.

    Non-blocking user input in loop without ncurses.

提交回复
热议问题