make a program that waits ro 2 seconds

Mar 20, 2011 at 9:01pm
I need to know how to make a program that waits for 2 seconds.
do you have an example?
Mar 20, 2011 at 9:05pm
sure

wait(2);

now you just need to make the function =)
Mar 20, 2011 at 9:38pm
uh is there a file that i need to include?
Mar 20, 2011 at 10:22pm
It dose not werk. do you have eny more ideas?
Mar 20, 2011 at 10:33pm
What is your OS? If you use POSIX systems, you can use the sleep() function.
Mar 20, 2011 at 10:34pm
You could look into the <ctime> library. Using it you should be able to make your program wait.
Mar 20, 2011 at 10:50pm
I steel can't get it to werk with <ctime>
Mar 20, 2011 at 10:53pm
The <ctime> library doesn't have a wait function. The suggestion by ultifinitus was to write your own wait function. I was saying that you could use the <ctime> library to do this.
Mar 20, 2011 at 11:39pm
His OS is Windows. #include<windows.h> and Sleep() should work.
Mar 21, 2011 at 1:24am
I feel really bad! But I'm laughing quite hard! Sorry ty!

Sleep works just fine for windows.

Boost has a sleep function for cross platform functionality.

overkill, you could use SDL.


Cross platform discussion::

http://www.gamedev.net/topic/474694-c-cross-platform-timing--sleep-functions/
Mar 21, 2011 at 10:23pm
oh I did not notice that I'm sopposedto capitolize the S in the Sleep command.
Topic archived. No new replies allowed.