How to read terminal’s input buffer immediately after keypress
It seems you are looking for something like this. The program essentially waits for user input. If up arrow key is pressed, the program prints “Arrow key pressed” and then exits. If anything else is pressed, it waits for the user to complete what he is typing and prints it, then exits. #include <termios.h> #include … Read more