当前位置:网站首页>C language to realize [shutdown program]
C language to realize [shutdown program]
2022-04-22 08:52:00 【Holy meow】

In the interpretation of the Shutdown Sequence front , You have to know a library function first system("shutdown -s -t 60") and system("shutdown -a), among “shutdown -s” Express To turn it off ,“shutdown -a” Express Cancel shutdown ,“-t 60” Express Delay 60 second ; To use the library function, you have to quote The header file #include<stdlib.h>.
Now start to realize the shutdown program :
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char input[20] = {
0 };
system("shutdown -s -t 60");
do
{
printf(" Your computer will shut down in a minute , If input : I am a pig . Just cancel the shutdown !\n Please enter :");
scanf("%s", input);
if (strcmp(input, " I am a pig ") == 0)
{
system("shutdown -a");
break;
}
printf(" Input error !!\n");
} while (1);
return 0;
}
If you want to play a prank , Just add the program to the server of your roommate's computer .

If this blog is helpful to you , Give bloggers a free like to show encouragement. Welcome to like comment collection ️, thank you !!!
If you have any questions or different opinions , Welcome to the comment area .
版权声明
本文为[Holy meow]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220749408654.html
边栏推荐
- Android Development - SQLite and sqlitedatabase Application Experiment 6 notes
- 二分查找【详解】
- 解决办法Access denied for user ‘root‘@‘localhost‘ (using password: YES)
- Solve the problem that the disk has space but cannot create files --- repair the server file system
- sql 中对varchar类型进行求和(sum)方法 (类型报错)
- C语言的学习目标和大致内容
- nacos源代码编译中遇到的问题解决后整理如下
- navicat连接oracle数据库失败:cannot load OCI DLL,87:Instant Client package is ...
- @ scheduled cron expression in quartz
- Insert sorting and optimization
猜你喜欢
随机推荐
CSDN(Markdown模式)如何实现:页内跳转
Meaning of GMT and CST in programming
Hyperledger Explorer 0.3.9 environment construction
Flume composition, put transaction, take transaction
PCIe学习-PCIe总线体系结构入门:事务层-数据链路层-物理层(八)
Nessus漏洞扫描简介
Abbreviation for greater than / less than / equal to (abbreviation of SQL database includes mangodb)
简述变长数组
Flume 组成,Put 事务,Take 事务
elastic-job安装部署接入
素数求解的N种境界
ROM, Ram, SRAM, DRAM, flash, SDRAM Difference
SQL窗口函数
Quick sequencing and optimization
相对路径和绝对路径区别(面试常问)
关于局部变量和整体变量的区别
蓝桥杯:Sine之舞[Jav语言用递归实现]
布尔类型【bool】
Scanf / sprintf, fscanf / fprintf, sscanf / sprintf, snprintf of C language
mysql导出表的具体字段信息(Navicat客户端详细操作)







