How do I add a time delay with Code::Blocks?

I've looked at a couple different websites and everything I've tried doesn't work. Any help would be appreciated. Thanks a lot.
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.
OS API calls? Sorry I'm new.
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
Topic archived. No new replies allowed.