Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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++:³ÌÐòµÄÄÚ´æ·ÖÅ䷽ʽ Alvin

1.ÄÚ´æ·ÖÅ䷽ʽ
¡¡¡¡ÄÚ´æ·ÖÅ䷽ʽÓÐÈýÖÖ£º
¡¡¡¡[1]´Ó¾²Ì¬´æ´¢ÇøÓò·ÖÅä¡£ÄÚ´æÔÚ³ÌÐò±àÒëµÄʱºò¾ÍÒѾ­·ÖÅäºÃ£¬Õâ¿éÄÚ´æÔÚ³ÌÐòµÄÕû¸öÔËÐÐÆڼ䶼´æÔÚ¡£ÀýÈçÈ«¾Ö±äÁ¿£¬static±äÁ¿¡£
¡¡¡¡[2]ÔÚÕ»ÉÏ´´½¨¡£ÔÚÖ´Ðк¯Êýʱ£¬º¯ÊýÄÚ¾Ö²¿±äÁ¿µÄ´æ´¢µ¥Ôª¶¼¿ÉÒÔÔÚÕ»ÉÏ´´½¨£¬º¯ÊýÖ´ÐнáÊøʱÕâЩ´æ´¢µ¥Ôª×Ô¶¯±»ÊÍ·Å¡£Õ»ÄÚ´æ·ÖÅäÔËËãÄÚÖÃÓÚ ......

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

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

LinuxÖÐI2C×ÜÏßÇý¶¯Ìåϵ½á¹¹

×î½üÔÚ¿´Linux 2.6.21Äں˵ÄI2CÇý¶¯£¬Ò²ÔÚÍøÉϲéÁËÒ»ÏÂ×ÊÁÏ£¬ÓдíÒ²Óжԣ¬ÓÐЩÐĵ㬼ǼÏÂÀ´°É¡£ÀïÃæÈÏʶ»òÐí¶àÓв»µ±Ö®´¦£¬»¹¿ÒÇëÖ¸Õý¡£
 
1. I2C ЭÒé
 
 1.1  I2C×ÜÏß¹¤×÷Ô­Àí
      I2C×ÜÏßÊÇÓÉÊý¾ÝÏßSDAºÍʱÖÓSCL¹¹³ÉµÄ´®ÐÐ×ÜÏߣ¬¸÷ÖÖ±»¿ØÖÆÆ÷¼þ¾ù²¢ÁªÔÚÕâÌõ×ÜÏ ......

I2C×ÜÏßÔÚLinuxϵͳÖеÄÇý¶¯Éè¼Æ

1 ÒýÑÔ
¡¡¡¡Linux²Ù×÷ϵͳÒò¾ßÓÐÔ´´úÂ빫¿ª¡¢±ãÓڲüõ¡¢Óй㷺µÄ´¦ÀíÆ÷Ö§³ÖµÈÓŵ㣬³ÉΪµ±Ç°Ç¶ÈëʽϵͳµÄÈÈÃÅÑ¡Ôñ¡£»ùÓÚI2C×ÜÏߵļüÅÌÀ©Õ¹É豸Ö÷ÒªÓÃÓÚÂú×ãǶÈëʽÉ豸ÖжԶఴ¼üµÄÐèÇó£¬Çý¶¯³ÌÐòÔÚϵͳÆô¶¯Ê±¶ÔÓ²¼þ½øÐгõʼ»¯¡£ÔÚϵͳÆô¶¯ºóʵÏÖÓ²¼þºÍÓ¦ÓóÌÐòÖ®¼äµÄÊý¾Ý½»»¥¡£Õë¶ÔS3C2410΢´¦ÀíÆ÷ºÍ¼üÅÌɨÃè¹ÜÀíÆ÷¼þ£¬ÉîÈ ......

½âÎö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ºÅ