linux下c语言关机程序
/* Offtimer.c.For auto halt. */
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#define DELAY 60/* Time of sleeping */
int main()
{
time_t now;
struct tm *p;
while(1)
{
now = time(NULL);
sleep(DELAY);/* To reduce cpu occupation */
p = localtime(&now);
if ((p->tm_hour = 14) && (p->tm_min >= 30))/ *This means the system will halt after 14:30 or 14:31 */
system("poweroff"); / *'poweroff' is the command in Red Flag Linux
Desktop 5.0 to turn off the computer.To do this you should be root. */
}
return 0;
}
引用gcc编译,另外需要有root用户的权利才能行。
相关文档:
例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......
4.1. Introduction to Linux Routing
The design of IP routing allows for very simple route definitions for small networks, while not hindering the flexibility of routing in complex environments. A key concept in IP routing is the ability to define what addresses are locally reachable as oppose ......
前言,Linux/Unix 社区的版块不热闹,新手太多,高手太忙,偶把自己这几年的Linux学习的过程讲讲,希望能给大家有点帮助,
引导初学者学习的方向,少走弯路,事半功倍,同时也是抛砖引玉,请过来人热烈发言。
1. 首先熟悉 Linux
建议在 Windows 上安装 VMware Workstation 6.5.0(以下简称VM), 下载种子在 ......
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define err(msg) perror(msg)
static void mkdirs(const char *dir)
{
char tmp[1024];
char *p;
&nbs ......
C,C++网络编程学习简明指南
1. 扎实的C,C++基础知识
参考资料《C程序设计》,《C++ primer》。
2. TCP/IP协议
经典书是:W.Richard Stevens 著《TCP/IP详解》三卷书,卷1是协议,卷2是实现,卷3是TCP事务协议等。还有官方的协议文档:RFC
当然也可以在网上下载电子书。
经典的开源协议分析工具:Wireshark.
......