Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C C++ ¶¨Ê±Æ÷ setitime

         setitimer()ΪLinuxµÄAPI£¬²¢·ÇCÓïÑÔµÄStandard Library£¬setitimer()ÓÐÁ½¸ö¹¦ÄÜ£¬Ò»ÊÇÖ¸¶¨Ò»¶Îʱ¼äºó£¬²ÅÖ´ÐÐij¸öfunction£¬¶þÊÇÿ¼ä¸ñÒ»¶Îʱ¼ä¾ÍÖ´ÐÐij¸öfunction£¬ÒÔϳÌÐòdemoÈçºÎʹÓÃsetitimer()¡£
         /*



Filename : timer.cpp

Compiler : gcc 4.1.0 on Fedora Core 5

Description : setitimer() set the interval to run function

Synopsis : #include <sys/time.h>

int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue);

struct itimerval {

struct timerval it_interval;

struct timerval it_value;

};



struct timeval {

long tv_sec;

long tv_usec;

}

Release : 11/25/2006

*/

#include <stdio.h> // for printf()

#include <unistd.h> // for pause()

#include <signal.h> // for signal()

#include <string.h> // for memset()

#include <sys/time.h> // struct itimeral. setitimer()



void printMsg(int);



int main() {

// Get system call result to determine successful or failed

int res = 0;

// Register printMsg to SIGALRM

signal(SIGALRM, printMsg);



struct itimerval tick;

// Initialize struct

memset(&tick, 0, sizeof(tick));

// Timeout to run function first time

tick.it_value.tv_sec = 1; // sec

tick.it_value.tv_usec = 0; // micro sec.

// Interval time to run function

tick.it_interval.tv_sec = 1;

tick.it_interval.tv_usec = 0;

// Set timer, ITIMER_REAL : real-time to decrease timer,

// send SIGALRM when timeout

res = setitimer(ITIMER_REAL,


Ïà¹ØÎĵµ£º

c/c++ ¾²Ì¬±äÁ¿ Ò»¸öʵÀý

#include <iostream>
#include <cstdlib>
using namespace std;
class Foo
{
public:
Foo(int ii):i(ii){}
int getInt(){return i;}
private:
int i;
};
class Bar
{
public:
static int FooVal(){c++; return f.getInt();}
int callsFooVal(){return c;}
private:
s ......

C/C++µ¥Ôª²âÊÔÀíÂÛ¾«Òª£¨Æߣ©

2.2 ½â¾ö¿É²âÐÔÎÊÌâ
    ÉÏÒ»½Ú¾ßÌå·ÖÎöÁ˿ɲâÐÔÎÊÌ⣬½ÓÏÂÀ´£¬ÎÒÃÇÀ´¿´¿´ÈçºÎ½â¾öÕâЩÎÊÌâ¡£ÏÂͼÖУ¬²ÊÉ«µÄ²¿·ÖÊÇÐèÒª½â¾öµÄ¿É²âÐԵľßÌåµÄÎÊÌâ¡£
   
ÓëÆäËû´úÂë¸ôÀë
    ΪÁËÌá¸ßЧÂÊ£¬Ó¦¸ÃÒ»´ÎÐÔ½«Ò»Î»¹¤³Ìʦ¸ºÔðµÄ²âÊÔÈÎÎñ¸ôÀë³öÀ´¡£¸ôÀëʱ£¬Ó¦°ÑÔ´Îļþ·ÖΪÈýÀࣺ± ......

ͨ¹ý#pragma pack(n)¸Ä±äC±àÒëÆ÷µÄ×Ö½Ú¶ÔÆ뷽ʽ

Ô­ÎĵØÖ·£ºhttp://blog.csdn.net/yc0188/archive/2005/02/26/303190.aspx
ÔÚCÓïÑÔÖУ¬½á¹¹ÊÇÒ»ÖÖ¸´ºÏÊý¾ÝÀàÐÍ£¬Æä¹¹³ÉÔªËؼȿÉÒÔÊÇ»ù±¾Êý¾ÝÀàÐÍ£¨Èçint¡¢long¡¢floatµÈ£©µÄ±äÁ¿£¬Ò²¿ÉÒÔÊÇһЩ¸´ºÏÊý¾ÝÀàÐÍ£¨ÈçÊý×é¡¢½á¹¹¡¢ÁªºÏµÈ£©µÄÊý¾Ýµ¥Ôª¡£ÔڽṹÖУ¬±àÒëÆ÷Ϊ½á¹¹µÄÿ¸ö³ÉÔ±°´Æä×ÔÈ»¶Ô½ç£¨alignment£©Ìõ¼þ·ÖÅä¿Õ¼ä¡£¸÷ ......

½âÎöxml org.w3c.dom


1.Òª½âÎöµÄXMLÎļþÈçÏ£º
<?xml version="1.0" encoding="GB2312"?>
<?xml-stylesheet href="student.xsl" type="text/xsl"?>
<StudentInfo>
 <student>
  <name>´ïÄÚ</name>
  <sex>ÄÐ</sex>
  <lesson>
   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ