[RESOLVED] How to have time out for user input?
Hi,
when using std::cin >> x; for getting a variable from user
the program is halted until the user inputs something. but
i want to have a time out (e.g. 10 seconds) which after
that the program continues with a default option.
how cant I get such a functionality?
Thanks in advance
Re: How to have time out for user input?
There is no way to do that with standard c++ functionality.
You will have to use OS features.
Kurt
Re: How to have time out for user input?
Then what should i do for linux & windows cases?
Re: How to have time out for user input?
could anyone tell me what function should I use for unix/linux?
Re: How to have time out for user input?
really need that, any tip is greatly appreciated
thanks!
Re: How to have time out for user input?
I have found a solution to it in the below page under
section "Implementing Timers Using Signals"
http://users.evtek.fi/~tk/rtp/signal....html#catching
we can use alarm() function call in unix