I know the POSIX sleep(x)
function makes the program sleep for x seconds. Is there a function to make the program sleep for x milliseconds in C++?
转载于:https://stackoverflow.com/questions/4184468/sleep-for-milliseconds
I know the POSIX sleep(x)
function makes the program sleep for x seconds. Is there a function to make the program sleep for x milliseconds in C++?
转载于:https://stackoverflow.com/questions/4184468/sleep-for-milliseconds
Note that there is no standard C API for milliseconds, so (on Unix) you will have to settle for usleep
, which accepts microseconds:
#include <unistd.h>
unsigned int microseconds;
...
usleep(microseconds);