函式簡介
函式原型:
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;
}