C++: sleep in MinGW
January 31, 2009 16:50:57 Last update: January 31, 2009 16:50:57
MinGW uses native windows API and there's no unix compatible
sleep
function. Windows native Sleep
(with capital S) sleeps in milliseconds.
#include <iostream> #include <windows.h> #define sleep(n) Sleep(1000 * n) using namespace std; int main() { cout << "Sleeping for 1 sec..." << flush; sleep(1); cout << "done" << endl; }
1 comment 
