From 173cc775afeff941b28452617e1da5de4da1a04a Mon Sep 17 00:00:00 2001 From: IsaacLiu2009 <87062174+IsaacLiu2009@users.noreply.github.com> Date: Mon, 15 Jul 2024 10:52:06 +0800 Subject: [PATCH] Update main.cpp --- WinShutdown/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/WinShutdown/main.cpp b/WinShutdown/main.cpp index 2c6358f..fd7cd70 100644 --- a/WinShutdown/main.cpp +++ b/WinShutdown/main.cpp @@ -62,8 +62,15 @@ int main(){ putchar('\n'); goto RESTART; } - char cmd[1000010]; + if (delta > 315360000){ + puts("时间间隔过长,请输入不超过10年的时间。"); + system("pause"); + putchar('\n'); + goto RESTART; + } + char cmd[60]; sprintf(cmd, "shutdown -s -t %lld", delta); + system("shutdown -a"); system(cmd); puts("如若错误操作,使用shutdown -a命令取消关机。"); system("pause");