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Óû§µÄȨÀû²ÅÄÜÐС£
Ïà¹ØÎĵµ£º
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 ......
1.ÔÚc³ÌÐòµ÷ÓÃc³ÌÐòºÍc++³ÌÐòµ÷ÓÃc++³ÌÐòʱ£¬²»Éæ¼°¡£
2.ÔÚc³ÌÐòµ÷ÓÃc++³ÌÐòʱ£¬C++µÄÍ·ÎļþÐèÌí¼Óextern "C"£¬µ«ÊÇÔÚCÓïÑÔÖв»ÄÜÖ±½ÓÒýÓÃÉùÃ÷ÁËextern "C"µÄ¸ÃÍ·Îļþ£¬Ó¦¸Ã½ö½«CÎļþÖн«C++Öж¨ÒåµÄextern "C"º¯ÊýÉùÃ÷ΪexternÀàÐÍ¡£
3.ÔÚc++³ÌÐòµ÷ÓÃc³ÌÐòʱ£¬ÔÚ°üº¬CÓïÑÔÍ·Îļþ£¨¼ÙÉèΪcExample.h£©Ê±£¬Ðè½øÐÐÏÂÁд¦Àí£ ......