Reputation: 131
I've searched over the internet for a function that can "hold" my program..
I've seen the function sleep()
, though it does not work for me, saying it is undeclared..
(I have included stdlib.h/time.h/iostream)
I do not have parrel stuff that are working in the side, so even if I stop the whole program, that's okay..
for example :
sleep(3000)
cout << "Hello World";
Thanks!
Upvotes: 1
Views: 268
Reputation: 122
try this.
usleep(microseconds)
1000 microseconds in a millisecond
You may need to: #include <unistd.h>
Upvotes: 1
Reputation: 10926
If you are using c++11 you have a portable way to suspend your thread: http://en.cppreference.com/w/cpp/thread/sleep_for
otherwise you have to include Windows.h to use Sleep: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686298%28v=vs.85%29.aspx
Upvotes: 2