'How to wait and READ char from stdin without waiting?
Hello There is a file where I draw picture using a loop. I want to exit loop when 'q' button is pressed. But I want the program is running during it is waiting 'q'. How to implement this behavior? I tried using system("stty -icanon min 1") but in this case program WAITS any char between loops. When ("stty -icanon min 0") the program doesn't read from stdin and terminal pushes all accumulated pressed buttons into stdout after finishing program Strings with loop in game.c file are: from 32 to 43. Thank in advance. Look at game.c file.
Solution 1:[1]
termios + unistd libraries helped me.
2nd way is ncurses library with its embedded function of parallel input.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alex-Kalinin-jr |
