/*
这是一个自己定义关机时间和提示消息的C语言程序
编译环境TC 2.0
eidtor by: spygg
2010-04-22 01:04:11
*/
#include <stdio.h>
#include <stdlib.h>
#include<dos.h>
#define ESC 0x011b
main()
{
char *seconds;
char cmd[30]="shutdown -s -t ";
char *kiding=" -c /"This is only a joke!!/"";/*这里你可以自己定义双引号中的内容*/
int key;
printf("Input seconds to shutdown the compute:/n");
scanf("%s",seconds);
strcat(cmd,seconds);
system(strcat(cmd,kiding));
clrscr();
while(seconds--)
{
if(bioskey(1))
{
key=bioskey(0);
if(key==ESC)
{
printf("The shutdown task is cancelled/n");
system("shutdown -a");
return 0;
}
}
clrscr();
printf("press ESC to quit/n");
printf("The compute will shutdown in %d seconds/n",seconds);
sleep(1);
clrscr();
}
}