sleep in c++

Introduce

hang up thread for a while
unsigned sleep(unsigned seconds);

  • In VC++ add head file #include <windows.h> or #include "stdafx.h"
  • In GCC add head file #include <unistd.h>

Caution

  • In windows Sleep() is first letter upper case, and unit in milliseconds
  • In Linux sleep() is first letter lower case, and unit in seconds

</br>
</br>
</br>
</br>
</br>
</br>
</br>

List

a b
Dos sleep(1); //停留1秒 </br>delay(100); //停留100毫秒
Windows Sleep(100); //停留100毫秒
Linux sleep(1); //停留1秒 </br>usleep(1000); //停留1毫秒

sleep function