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Óû§µÄȨÀû²ÅÄÜÐС£
Ïà¹ØÎĵµ£º
ÐźÅÖ¸¶¨´¦Àíº¯Êý
void (*signal (int signum,void (*handle)(int)))(int);ÉèÖÃij¸öÐźŵĴ¦Àí·½·¨
int sigaction(int signum,const struct sigaction *act,struct sigaction *oldact);ÓÃÓÚ¼ì²é»ò¸Ä±ä½ø³ÌÔÚ½Óµ½ÐźÅʱµÄ¶¯×÷
Ðźż¯²Ù×÷º¯Êý
static inline void sigaddset(sigset_t *set,int _sig);
static inline voi ......
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 ......
ÔÚºÏ×÷¿ª·¢Ê±£¬C#ʱ³£ÐèÒªµ÷ÓÃC++DLL£¬µ±´«µÝ²ÎÊýʱʱ³£Óöµ½ÎÊÌ⣬ÓÈÆäÊÇ´«µÝºÍ·µ»Ø×Ö·û´®ÊÇ£¬ÏÖ×ܽáһϣ¬·ÖÏí¸ø´ó¼Ò£º
VC++ÖÐÖ÷Òª×Ö·û´®ÀàÐÍΪ£ºLPSTR,LPCSTR, LPCTSTR, string, CString, LPCWSTR, LPWSTRµÈ
µ«×ªÎªC#ÀàÐÍÈ´²»ÍêÈ«Ïàͬ¡£
Ö÷ÒªÓÐÈçϼ¸ÖÖת»»£º
½«stringתΪIntPtr£ºIntPtr System.Runtime.InteropServ ......
#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/S¶àÏß³ÌÓ¦ÓÃ,ÉÔ΢À©Õ¹¾Í¿ÉÒÔÓÃÁË
/*socketÊÇÍøÂçÓ¦ÓóÌÐòµÄºËÐÄ£¬ÔÚ·þÎñÆ÷¶Ë»ò¿Í»§¶ËÍøÂçÓ¦ÓóÌÐòÖУ¬socket½ÔΪ²»¿ÉȱÉÙµÄÒªËØ
*ÔÚ·þÎñÆ÷³£¼ûµÄÓ¦ÓÃÓУºFTP·þÎñÆ÷£¬MAIL·þÎñÆ÷£¨SMTP£¬POP3£¬IMAP4ÐÒ飩£¬WEB£¨HTTPÐÒ飩
*½¨Á¢·þÎñÆ÷¶ËSOCKETµÄÓ¦ÓóÌÐò²½ÖèÈçÏ£º
*1¡£½¨Á¢·þÎñÆ÷¶ËµÄSOCKET£¬²¢ÇÒÒÔ´ ......