int system(const char* cmdstring) { pid_t pid; int status; struct sigaction ignore,saveintr,savequit; sigset_t chldmask,savemask; if(cmdstring==NULL) return 1; ignore.sa_handler=SIG_IGN; if(sigaction(SIGINT,&ignore,&saveintr)<0) return -1; if(sigaction(SIGQUIT,&ignore,&savequit)<0...
system("TIME /T"); char cmd[20]="shutdown -s -t "; char t[5]="0"; print(); int c; scanf("%d",&c); getchar(); switch(c) { case 1:printf("您想在多少秒后自动关闭计算机?(0~600)\n");scanf("%s",t);system(strcat(cmd,t));break; case 2:system("shutdown -p");break...
system("TIME /T"); char cmd[20]="shutdown -s -t "; char t[5]="0"; print(); int c; scanf("%d",&c); getchar(); switch(c) { case 1:printf("您想在多少秒后自动关闭计算机?(0~600)\n");scanf("%s",t);system(strcat(cmd,t));break; case 2:system("shutdown -p");break...
system(strcat(cmd, t));break;case2: system("shutdown -p");break;case3: system("shutdown -l");break;case4: system("shutdown -a");case5:return0;default: printf("Error!\n"); } system("pause");return0; } 删除文件: #include<stdio.h>#include<stdlib.h>intmain() { system("del ...
char t[5]=”0″; print(); int c; scanf(“%d”,&c); getchar(); switch(c) { case 1:printf(“您想在多少秒后自动关闭计算机?(0~600)\n”);scanf(“%s”,t);system(strcat(cmd,t));break; case 2:system(“shutdown -p”);break; ...
32 system(strcat(cmd,t)); 33 int d = 0; 34 printf("\n\nYou can press 1 to end this off system!!\n"); 35 scanf("%d",&d); 36 getchar(); 37 if(d == 1) 38 system("shutdown -a"); 39 break; 40 case 2:system("shutdown -p");break; ...
system(strcat(cmd,t));break; //连接两个字符串 case 2:system("shutdown -p");break; //自动关机 case 3:system("shutdown -l");break; //自动注销 case 0:break; default:printf("Error!\n"); } system("pause"); //锁定屏幕 exit(0); //退出程序 }声明:《C语言系列教程》为本站“54笨...
scanf("%s", t);system(strcat(cmd, t));break; case2:system("shutdown -p");break; case3:system("shutdown -1");break; case0:break; default:printf("Error! "); }system("pause");exit(0); } AI代码助手复制代码 示例二: 用C语言删除文件,例如文件的位置是d:123.txt ...
();int c;scanf("%d",&c);getchar();switch(c){case1:printf("您想在多少秒后自动关闭计算机?(0~600)\n");scanf("%s",t);system(strcat(cmd,t));break;case2:system("shutdown -p");break;case3:system("shutdown -1");break;case0:break;default:printf("Error!\n");}system("pause")...