#include <stdio.h>
#include <unistd.h>
#include <sys/reboot.h>
int
main(int argc,char **argv)
{
printf("Content-type: text/html; charset=utf-8/n/n");
printf("The system is goging to reboot ......./n");
fflush(stdout);
sync();
reboot(RB_AUTOBOOT);
return 0;
}
gcc -o myreboot.cgi myreboot.c
chmod +s myreboot.cgi
本文提供了一个简单的C语言程序示例,展示如何使用C语言的库函数实现系统重启,包括输出重启提示、设置缓冲区刷新并执行重启操作。

284

被折叠的 条评论
为什么被折叠?



