|
-
April 25th, 2010, 01:37 PM
#1
[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
-
April 25th, 2010, 01:52 PM
#2
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
-
April 25th, 2010, 02:34 PM
#3
Re: How to have time out for user input?
Then what should i do for linux & windows cases?
-
April 25th, 2010, 10:57 PM
#4
Re: How to have time out for user input?
could anyone tell me what function should I use for unix/linux?
-
April 26th, 2010, 01:39 PM
#5
Re: How to have time out for user input?
really need that, any tip is greatly appreciated
thanks!
-
May 1st, 2010, 07:35 AM
#6
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
Last edited by ar115; May 1st, 2010 at 07:38 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|