C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 04-20-2002, 02:11 PM   #1
Unleashed
 
Join Date: Sep 2001
Posts: 1,755
give user time to read messages

Code:
printf("I am doing a routine...");
system("choice /c:. /t:.,03 /n >NUL");
If you are doing something in your program that may run very fast on somebody's computer, they might not have time to read the message. They may see a message fly by really quick like, then wonder what your program is doing to their computer. Is there a way to convert the above system call ( forcing choice to continue by default - without the user knowing it ) into something more C-ish? Can you have control over how long a pause will take place, hence giving the user time to read your short -or- long message?

http://www.cprogramming.com/cboard/s...threadid=15811

Should I look into this post?
__________________
The world is waiting. I must leave you now.
Shadow is offline   Reply With Quote
Old 04-20-2002, 08:47 PM   #2
Unleashed
 
Join Date: Sep 2001
Posts: 1,755
> Depends on your OS and compiler

Windows 98 SE & GCC.
__________________
The world is waiting. I must leave you now.
Shadow is offline   Reply With Quote
Old 04-21-2002, 12:54 AM   #3
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,689
Something like this
Code:
#include <stdio.h>
#include <time.h>
#include <conio.h>

void wait_for_key_or_timeout ( int seconds ) {
    clock_t endtime = clock() + seconds * CLOCKS_PER_SEC;
    while ( !kbhit() && ( clock() < endtime ) );
}

int main ( ) {
    int i;
    for ( i = 0 ; i < 100 ; i++ ) {
        printf( "%d\n", i );
        if ( (i+1) % 25 == 0 ) wait_for_key_or_timeout(3);
    }
    return 0;
}
Salem is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using pointers Big_0_72 C Programming 3 10-28-2008 07:51 PM
need help in time zone Gong C++ Programming 2 01-03-2007 04:44 AM
Message class ** Need help befor 12am tonight** TransformedBG C++ Programming 1 11-29-2006 11:03 PM
Serial Communications in C ExDigit Windows Programming 7 01-09-2002 10:52 AM
Need to give user more time Natase C Programming 6 09-16-2001 05:21 PM


All times are GMT -6. The time now is 12:42 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22