Cross platform Sleep function for C++
Yup. But this only works in C++11 and later. #include <chrono> #include <thread> … std::this_thread::sleep_for(std::chrono::milliseconds(ms)); where ms is the amount of time you want to sleep in milliseconds. You can also replace milliseconds with nanoseconds, microseconds, seconds, minutes, or hours. (These are specializations of the type std::chrono::duration.) Update: In C++14, if you’re sleeping for a … Read more