I’m trying to add some details to a terminal application that I’m creating with ncurses.
The application is something like a quiz with timeout… if the user wastes too much time, timeout happens and cleans the screen.
Now the problem: how can I show the text that the user had inserted before timeout and edit/reedit if he wants?
Example:
Q:Do you feel happy? (correct answer Yes, I feel happy)
A:Yes, I fe (TIMEOUT, clean the screen, question is printed again but no “Yes, I fe” is printed).
I don’t know if there is any possibility to add this to the stdin buffer or line buffer…
Ideas…
Thanks a lot
You could do it like that:
nodelay(stdscr, TRUE);getch()and checking if it returns a value>0usleep()and check for timeout; if the timeout happened, process it