cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
How do I add a time delay with Code::Blo
How do I add a time delay with Code::Blocks?
Aug 6, 2012 at 9:54am UTC
AandR2024
(50)
I've looked at a couple different websites and everything I've tried doesn't work. Any help would be appreciated. Thanks a lot.
Aug 6, 2012 at 9:58am UTC
Zephilinox
(595)
you need to either use OS API calls, or an external library that does it for you, the first isn't cross-platform, the second is, but only for platforms the library supports.
Aug 6, 2012 at 10:26am UTC
AandR2024
(50)
OS API calls? Sorry I'm new.
Aug 6, 2012 at 10:32am UTC
Peter87
(11234)
If your compiler supports it (which it probably doesn't) you can use std::this_thread::sleep_for.
http://en.cppreference.com/w/cpp/thread/sleep_for
Otherwise I think you can use Sleep on windows
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686298%28v=vs.85%29.aspx
and sleep on *nix
http://pubs.opengroup.org/onlinepubs/009604599/functions/sleep.html
Last edited on
Aug 6, 2012 at 10:32am UTC
Topic archived. No new replies allowed.