_sleep

_sleep的函式功能: 實現延時,單位為毫秒。1000毫秒是1秒。 在VS2005中如果使用該函式會有提示: 這個函式將在未來的庫中捨棄,請用Sleep函式來代替。

基本介紹

  • 中文名:_sleep
  • 所屬庫: stdlib.h
  • 相關函式: Sleep
  • 函式功能: 實現延時,單位為毫秒
函式簡介,程式示例,

函式簡介

函式原型:
VS2005: _CRT_OBSOLETE(Sleep) _CRTIMP void __cdecl _sleep(__in unsigned long _Duration);
VC++6.0: _CRTIMP void __cdecl _sleep(unsigned long);
所屬庫: stdlib.h
相關函式: Sleep

程式示例

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char i, j;
char commamd[16] = {0};
char color_order[4] = {0};
for(i=0; i<0xf; i++)
{
for(j=0; j<0xf; j++)
{
if(i == j)
{
continue;
}
else
{
memset(color_order, 0, sizeof(color_order));
memset(commamd, 0, sizeof(commamd));
strcpy_s(commamd, 16, "color ");
sprintf(color_order, "%.1X%.1X", i, j);
strncat(commamd, color_order, 2);
printf("command: %s\n", commamd);
_sleep(1000);
system(commamd);
}
}
}
return 0;
}

相關詞條

熱門詞條

聯絡我們