shutdown
/缺慧s
“,然后保存到桌面,起个名字叫
guanji.bat
文件中。然后在桌伏穗答面上双击该文件,即可实现关机功能。
码了一下午,源程序和生成的软件通过附件上传了,你悬赏好低,不过无所谓啦,望采纳
关键部分代码贴出,供大家参考,欢迎指正!
#include<stdio.h>#include<stdlib.h>
#include<string.h>
#include<time.h>
void cancelPlan(void)
{
system("shutdown -a")
printf("关机计划已经取消\n")
system("pause")
}
void ShoutDown(void)
{
char Now_time[10]
char *t
char time[]="18:50:00"
long seconds_time
long seconds_nowtime
long delay_time
int i=0,flag=0
char Plan[24]="Shutdown.exe -s -t 86400"
char Ack[19]={-60,-29,-53,-5,-62,-24,-54,-57,-44,-38,-74,-70,-50,-46,-62,-16,-93,-95}
Plan[19]=' '//8
Plan[20]=' '//6
Plan[21]=' '//4
Plan[22]=' '//0
Plan[23]=' '//0
t=Now_time
printf("注意:只能输入今天的时间\n"简御缓)
printf("请输入关机时拆岁间:(特别注意格式:")
_strtime(t)
printf("%s(半角冒号))\n",Now_time)
scanf("%s",time)
seconds_time=time[7]+time[6]*10+time[4]*60+time[3]*10*60+time[1]*60*60+time[0]*10*60*60
seconds_nowtime=Now_time[7]+Now_time[6]*10+Now_time[4]*60+Now_time[3]*10*60+Now_time[1]*60*60+Now_time[0]*10*60*60
delay_time=seconds_time-seconds_nowtime
if(delay_time<0)
{
printf("%s\n时间早过了,重新拦模输入\n",Ack)
system("pause")
}
else
{
for(i=0i<5i++)
{
if(flag==0)
{
Plan[23-i]=delay_time%10+0x30
}
delay_time/=10
if(delay_time==0)flag=1
}
Plan[24]='\0'
printf("%s\n",Plan)
system(Plan)
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)