An event loop can be used to handle user input. One of the most important types of input to consider is that which is used to exit a program. Say we have a program that renders text on-screen. At some point, we want to exit the program. We need to read a typed character, check that the character is equal to our exit character, and if so, stop our loop and exit the program.
How to write an event loop using ncurses
How to write an event loop using ncurses
How to write an event loop using ncurses
An event loop can be used to handle user input. One of the most important types of input to consider is that which is used to exit a program. Say we have a program that renders text on-screen. At some point, we want to exit the program. We need to read a typed character, check that the character is equal to our exit character, and if so, stop our loop and exit the program.