Re: [PBML] Re: Displaying counter
Thanks for the reply.
I am using the following algorithm to achieve my task:
(a) Display the string which prompts for user input.
(b) Start the alarm timer with the required timeout.
(c) If the user inputs data, then stop the timer.
(d) If the user has not input data, upon receiving the SIGALRM (sent on elapse of alarm timer), display appropriate message and quit.
This works fine. I could arrive at this algorithm from the suggestions you have provided. Thanks once again.
But, another thing is the display. I am using Linux machine. I want to display the counter ie if the timeout is 10 seconds, then I want to display the seconds remaining for the user to input data. This display must be at the same location on the screen.
For eg, if 10 is displayed (assuming 10 seconds left), then after 1 second,10 must be erased and 9 must be displayed at the same location on the screen. After 1 second, 9 must be erased and 8 must be displayed at the same location on the screen and so forth. How do I achieve this? In other words, how can I erase (or delete) the contents at a particular location on the screen and write new content to the same location of the screen?
Damien Carbery <daymobrew@...> wrote:
--- In firstname.lastname@example.org, Sreeram B S <sreeramabsc@y...>
>the user to provide data. If the user does not provide data within
> Hello friends,
> I am into writing of a program which waits for few seconds for
that period, then the program quits.
> Now, I would like to display the time remaining for the user toinput data. This display must be at the same location but the value
must be decrementing each second and the updated value must be displayed.
>display 5,4,3,2,1 but at the same location. ( a kind of count-down ).
> For eg, if the timer value is 5 seconds, then I would like to
> Could anyone kindly guide me through this?dont have the code to post here. Kindly excuse me for this.
> I am unaware as to where to make the beginning of this and so, I
>Look at perlfaq8 "How do I timeout a slow event?"
> Please suggest / guide.
"How do I timeout a slow event?
Use the alarm() function, probably in conjunction with a signal
handler, as documented in Signals in the perlipc manpage and the
section on ``Signals'' in the Camel. You may instead use the more
flexible Sys::AlarmCall module available from CPAN.
The alarm() function is not implemented on all versions of Windows.
Check the documentation for your specific version of Perl."
If you are on Windows you might be able to use signals
You could have a timeout each second to display the new number. If you
get to zero you would continue on with the program.
Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
Basic programming language C programming language Computer programming languages The c programming language C programming language List of programming languages
YAHOO! GROUPS LINKS
Visit your group "perl-beginner" on the web.
To unsubscribe from this group, send an email to:
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Find Great Deals on Holiday Gifts at Yahoo! Shopping
[Non-text portions of this message have been removed]