Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,397 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,105 people online right now. Registration is fast and FREE... Join Now!




Getting a program to wait.

 
Reply to this topicStart new topic

Getting a program to wait.

chris.tkd
28 Sep, 2006 - 05:02 AM
Post #1

D.I.C Head
Group Icon

Joined: 26 Sep, 2006
Posts: 60


Dream Kudos: 25
My Contributions
is there a function in C which allow you to specifiy the time you would like the program to wait.
ive tryed
CODE
wait(10);
but it dosnt seem to work
i would like it in an enviroment such as
CODE

#include <stdio.h>
main()
{
      printf("input 1");
      wait(1000);
      printf("input 2");
}
if anyones got any ideas i would be most grateful. cheers.
User is offlineProfile CardPM
+Quote Post

Mrafcho001
RE: Getting A Program To Wait.
28 Sep, 2006 - 05:24 AM
Post #2

D.I.C Addict
Group Icon

Joined: 1 Nov, 2005
Posts: 753



Thanked: 5 times
Dream Kudos: 120
My Contributions
For windows platforms:
CODE

#include <windows.h>

int mian()
{
Sleep(dwMilliseconds);
return 0;
}

User is offlineProfile CardPM
+Quote Post

DeeViLiSh
RE: Getting A Program To Wait.
28 Sep, 2006 - 09:21 AM
Post #3

D.I.C Head
Group Icon

Joined: 25 Jul, 2006
Posts: 175



Thanked: 1 times
Dream Kudos: 575
My Contributions
Sleep(100);

That waits for 100 milli seconds.
You need to include the header windows.h in order to work.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/5/08 02:58AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month