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

cÁ¬½Ó·û

cÓïÑԺ궨ÒåµÄÁ¬½Ó·ûÓÐÄÄЩ
[´ËÎÊÌâµÄÍƼö´ð°¸]
(Ò»)ºê¶¨ÒåÖеÄ## Á¬½Ó·ûÓë# ·û
## Á¬½Ó·ûºÅÓÉÁ½¸ö¾®ºÅ×é³É£¬Æ书ÄÜÊÇÔÚ´ø²ÎÊýµÄºê¶¨ÒåÖн«Á½¸ö×Ó´®(token)Áª½ÓÆðÀ´£¬´Ó¶øÐγÉÒ»¸öеÄ×Ó´®¡£µ«Ëü²»¿ÉÒÔÊǵÚÒ»¸ö»òÕß×îºóÒ»¸ö×Ó´®¡£ËùνµÄ×Ó´®(token)¾ÍÊÇÖ¸±àÒëÆ÷Äܹ»Ê¶±ðµÄ×îСÓï·¨µ¥Ôª¡£¾ßÌåµÄ¶¨ÒåÔÚ±àÒëÔ­ÀíÀïÓÐÏ꾡µÄ½âÊÍ£¬µ«²»ÖªµÀÒ²ÎÞËùν¡£Í¬Ê±ÖµµÃ×¢ÒâµÄÊÇ#·ûÊÇ°Ñ´«µÝ¹ýÀ´µÄ²ÎÊýµ±³É×Ö·û´®½øÐÐÌæ´ú¡£ÏÂÃæÀ´¿´¿´ËüÃÇÊÇÔõÑù¹¤×÷µÄ¡£ÕâÊÇMSDNÉϵÄÒ»¸öÀý×Ó¡£
¼ÙÉè³ÌÐòÖÐÒѾ­¶¨ÒåÁËÕâÑùÒ»¸ö´ø²ÎÊýµÄºê£º
#define paster( n ) printf( "token" #n " = %d", token##n )
ͬʱÓÖ¶¨ÒåÁËÒ»¸öÕûÐαäÁ¿£º
int token9 = 9;
ÏÖÔÚÔÚÖ÷³ÌÐòÖÐÒÔÏÂÃæµÄ·½Ê½µ÷ÓÃÕâ¸öºê£º
paster( 9 );
ÄÇôÔÚ±àÒëʱ£¬ÉÏÃæµÄÕâ¾ä»°±»À©Õ¹Îª£º
printf( "token" "9" " = %d", token9 );
×¢Òâµ½ÔÚÕâ¸öÀý×ÓÖУ¬paster(9);ÖеÄÕâ¸ö”9”±»Ô­·â²»¶¯µÄµ±³ÉÁËÒ»¸ö×Ö·û´®£¬Óë”token”Á¬½ÓÔÚÁËÒ»Æ𣬴Ӷø³ÉΪÁËtoken9¡£¶ø#nÒ²±»”9”ËùÌæ´ú¡£
¿ÉÏë¶øÖª£¬ÉÏÃæ³ÌÐòÔËÐеĽá¹û¾ÍÊÇÔÚÆÁÄ»ÉÏ´òÓ¡³ötoken9=9
(¶þ)"\"ÓëÒ»¸ö½Ï³¤Õ¼¶àÐеĺê
ºê¶¨ÒåÖÐÔÊÐí°üº¬Á½ÐÐÒÔÉÏÃüÁîµÄÇéÐΣ¬´Ëʱ±ØÐëÔÚ×îÓұ߼ÓÉÏ"\"ÇÒ¸ÃÐÐ"\"ºó²»ÄÜÔÙÓÐÈκÎ×Ö·û£¬Á¬×¢ÊͲ¿·Ö¶¼²»ÄÜÓУ¬ÏÂÃæµÄÿÐÐ×îºóµÄÒ»¶¨ÒªÊÇ"\","\"ºóÃæ¼ÓÒ»¸ö¿Õ¸ñ¶¼»á±¨´í£¬¸ü²»Äܸú×¢ÊÍ¡£
#define exchange(a,b) {\
int t;\
t=a;\
a=b;\
b=t;\
}
¾­³£Ê¹ÓÃ_T()ºê,ËüÊÇÔõôÀ´µÄ?ÓÃVA¿´ÁËÒ»ÏÂ,Ô­À´_TÊÇ__T
#define _T(x)       __T(x)
ÔÙ¿´¿´__T
ÔÚtchar.hÖÐ
#ifdef  _UNICODE
#define __T(x)      L ## x
#else
#define __T(x)      x
#endif
ÄÇô,Õâ¸ö##ÊÇʲôÄØ?Ô­À´ËüÊÇÒ»¸öÁ¬½Ó·û,½«##×óÓÒÁ½±ßµÄ±í´ïʽÁ¬½Ó³ÉÒ»¸ö.±ÈÈç,ÔÚ_UNICODE»·¾³ÏÂ,
_T(“Unicode“) == L“Unicode“
²»¹ýÐèҪעÒâµÄÊÇ,ºêÊÇÓɱàÒëÆ÷ÔÚ±àÒë½×¶Îʶ±ðµÄ,ËùÒÔ²»ÄÜÖ¸Íû³ÌÐòÔËÐÐʱÆðµ½Á¬½Ó×÷ÓÃ.±ÈÈç:
int A0, A1, A2, A3;
for (int i = 0; i < 4; i++)
{
 A##i = i;
}
ÕâÖÖ´úÂë¾ÍÎÞ·¨±àÒëÁË.
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/faithmy509/archive/2009/02/20/3914026.aspx


Ïà¹ØÎĵµ£º

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

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

C C++ ¶¨Ê±Æ÷ setitime

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

......

linux cÓïÑÔ selectº¯ÊýÓ÷¨

  SelectÔÚSocket±à³ÌÖл¹ÊDZȽÏÖØÒªµÄ£¬¿ÉÊǶÔÓÚ³õѧSocketµÄÈËÀ´Ëµ¶¼²»Ì«°®ÓÃSelectд³ÌÐò£¬ËûÃÇÖ»ÊÇÏ°¹ßдÖîÈç connect¡¢accept¡¢recv»òrecvfromÕâÑùµÄ×èÈû³ÌÐò£¨Ëùν×èÈû·½Ê½block£¬¹ËÃû˼Ò壬¾ÍÊǽø³Ì»òÊÇÏß³ÌÖ´Ðе½ÕâЩº¯Êýʱ±ØÐëµÈ
´ýij¸öʼþµÄ·¢Éú£¬Èç¹ûʼþûÓз¢Éú£¬½ø³Ì»òÏ߳̾ͱ»×èÈû£¬º¯Êý²»ÄÜÁ¢¼´·µ» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ