Refresh Terminal while waiting for user input

Im trying to write a program that can display the status of the threads that are running and update when something changes while still waiting for user input. I am doing this programming in Linux and have been looking into curses, but i am still a little lost.. Any help would be greatly appreciated!!

this is what i want the main menu to look like:

| System Status |
| Data Log | Running |
| Main System | Starting |
| a) Config Menu |
| b) Stop System |
| c) Quit |
Please Enter Your Selection:

This is just a sample, but i would like to update the system status part while still waiting for the user input.

Last edited on
To do this for the console, the only way (that I know of) is to create a separate thread and have it do a countdown (waiting for user input). Once the countdown reaches zero, the thread ends and so will cin (or equivalent). Only at that time u'll be able to update the System Status (if there has been any changes since last update). The reason is because 'cin' waits indefinitely for user input...
Last edited on
I have thought about that already, The one thing that i am concerned about is if you try to type in your option and cant press enter before the screen refreshes... I know its a very small problem, but i would like to try to avoid it if i can.. :p
I am also running this on an arm based computer and didnt want to add the extra thread because its a control system for a rocket.. so the faster it runs the better.
Hmmm maybe _kbhit() could do it. If it returns true then u can cancel a status update while collecting each key pressed until a delimiter or timeout...
Topic archived. No new replies allowed.