I need help in pausing the system. I want some kind of timed pause. I have heard of some people using some sort of time functions to pause the system for a allowed amount of time.
Your help is appreciated.
Printable View
I need help in pausing the system. I want some kind of timed pause. I have heard of some people using some sort of time functions to pause the system for a allowed amount of time.
Your help is appreciated.
#include <dos.h>
main()
{
....
....
delay(1000); //Approx 1 sec.
....
}
Yeah, use delay or some time function like that. There might be a predefined constant that represents one second on all computers so that it will run the same way on AMD 1.4's as it would run on PII 400mhz systems. Not too sure though.
Just noticed "dos.h". That is not too good. Look for something under "time.h" instead.
If you are working under UNIX you could have used the following functions:
sleep(num_of_seconds_to_sleep);
usleep(num_of_microseconds_to_sleep);
If you are working under other platform, look for their equivalent in time.h, utime.h or other time related header files.
i think the easiest way is
#include <conio.h>
and then just use the
getch();
command in the program.
but notice: this is a "press-any-key-to-continue" function... :)
Dear Dune911,
by using getch() there is no way to implement a time-based delay. getch() will cause an infinite delay unless someone actually enters something on a keyboard.
Cheers:D