ANSI C¶ÁÊé±Ê¼ÇϵÁÐÖ®×Ö·û¼¯Æª µÚËÄÕ ×Ö½ÚÐò
"endian"Õâ¸ö´Ê³ö×Ô<<¸ñÁзðÓμÇ>>,СÈ˹úµÄÄÚÕ½¾ÍÔ´ÓÚ³Ô¼¦µ°Ê±ÊǾ¿¾¹´Ó´óÍ·(Big-Endian)Çÿª»¹ÊÇ´ÓСͷ(Little-Endian)Çÿª.ÎÒÃÇÒ»°ã½«endian·Òë³É"×Ö½ÚÐò",½«big endianºÍlittle endian³Æ×÷"´ó¶Ë"ºÍ"С¶Ë".
ÔÚ¼ÆËã»ú¿ÆѧÁìÓòÖÐ,×Ö½ÚÐòÊÇÖ¸´æ·Å¶à×Ö½ÚÊý¾ÝµÄ×Ö½ÚµÄ˳Ðò,µäÐ͵ÄÇé¿öÊÇÕûÊýÔÚÄÚ´æÖеĴæ·Å·½Ê½ºÍÍøÂç´«ÊäµÄ´«Êä˳Ðò.¼ÈÈ»ÎÒÃÇÔÚ±¾Æª½éÉÜ×Ö½ÚÐò,ÄÇËù˵µÄÖصãÔòÆäÒ»ÊÇ×Ö·û(¶à×Ö½Ú)ÔÚÄÚ´æÖеÄ×Ö½Ú´æ·Å˳Ðò(ÕâÓëÇ°ÃæµÄµäÐÍÇé¿öÊÇͬһÀà),Æä¶þÊÇ×Ö·û(¶à×Ö½Ú)ÔÚÎļþÖб£´æµÄ±àÂë˳Ðò.
Ò»°ã̸µ½×Ö½ÚÐòÎÊÌâ,¶¼ÊÇÖ¸ÉÏÃæ˵µÄµäÐÍÇé¿ö,Ö÷ÒªÊÇ´¦ÀíÄÚ´æÖÐÊý¾Ý.ÕâÀïµÄ×Ö½ÚÐò¸úCPUÏà¹Ø,Ö÷ÒªÉæ¼°Á½´óÅÉϵ:MotorolaϵÁкÍIntelµÄx86ϵÁÐ.Motorola²ÉÓÃbig endian·½Ê½´æ´¢Êý¾Ý,¶øx86ϵÁÐÔò²ÉÓÃlittle endian·½Ê½´æ´¢Êý¾Ý,µ±È»,»¹ÓÐARMµÈ¿ÉÅäÖÃ"´ó¶Ë""С¶Ë"CPUϵÁÐ.
big endianÊÇÖ¸µÍµØÖ·´æ·Å×î¸ßÓÐЧ×Ö½Ú,¶ølittle endianÔòÊǵ͵ØÖ·´æ·Å×îµÍÓÐЧ×Ö½Ú. ÈçÊý×Ö0x12345678ÔÚÁ½ÖÖ²»Í¬×Ö½ÚÐòCPUÖеĴ洢˳ÐòÈçÏÂËùʾ:
Big Endian
µÍµØÖ· ¸ßµØÖ·
----------------------------------------->
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 12 | 34 | 56 | 78 |
&
Ïà¹ØÎĵµ£º
Ò»¸ö¼òµ¥µÄC/S¶àÏß³ÌÓ¦ÓÃ,ÉÔ΢À©Õ¹¾Í¿ÉÒÔÓÃÁË
/*socketÊÇÍøÂçÓ¦ÓóÌÐòµÄºËÐÄ£¬ÔÚ·þÎñÆ÷¶Ë»ò¿Í»§¶ËÍøÂçÓ¦ÓóÌÐòÖУ¬socket½ÔΪ²»¿ÉȱÉÙµÄÒªËØ
*ÔÚ·þÎñÆ÷³£¼ûµÄÓ¦ÓÃÓУºFTP·þÎñÆ÷£¬MAIL·þÎñÆ÷£¨SMTP£¬POP3£¬IMAP4ÐÒ飩£¬WEB£¨HTTPÐÒ飩
*½¨Á¢·þÎñÆ÷¶ËSOCKETµÄÓ¦ÓóÌÐò²½ÖèÈçÏ£º
*1¡£½¨Á¢·þÎñÆ÷¶ËµÄSOCKET£¬²¢ÇÒÒÔ´ ......
¿Í»§¶Ë²¿·Ö£º
ÕâÑù¿´À´AndroidµÄViewµÄ´´½¨ºÍXµÄ´°¿Ú´´½¨ÊǺÜÀàËƵģº¿Í»§¶Ë·¢ËÍÇëÇó£¬È÷þÎñÆ÷¶ËÀ´ÊµÏÖ¾ßÌåµÄ²Ù×÷¡£
·þÎñÆ÷²¿·Ö»¹Ã»Óп´Ã÷°×£¬Ï»ØÔÙÕû¡£ ......
va_listÊÇc/c++ÓïÑÔÎÊÌâÖнâ¾ö¿É±ä²ÎÊýµÄÒ»×éºê.ÏÈÀ´¿´Ò»¸ö³ÌÐòÀý×Ó°É.
view plaincopy to clipboardprint?
#include <stdarg.h>
/**¡¡º¯ÊýÃû£ºmax
*¡¡¹¦ÄÜ£º·µ»Øn¸öÕûÊýÖеÄ×î´óÖµ
* ²ÎÊý£ºnum£ºÕûÊýµÄ¸öÊý . ......
ͨ¹ýÇ°ÃæÁ½Æª£¬ÏàÐÅ´ó¼ÒÒѾ»ù±¾Á˽âÁËÎÒÃǵÄÑо¿Ë¼Â·¡£¼ÈÈ»ÊÇÑо¿£¬ÄÇô±ØÐëµÄÑо¿¹¤¾ß¾ÍµÃÊìÁ·ÕÆÎÕÁË¡£ÕâÀïÎÒËùÖ¸µÄÑо¿¹¤¾ß¾ÍÊÇVC£¬ÎÒËùʹÓõÄVC°æ±¾ÊÇ2005¡£±¾ÎÄÒ²½«¸ù¾ÝVC2005½øÐÐ̽ÌÖ¡£¿ÉÄܺܶàÅóÓÑ»òÕß³õѧÕß»¹ÊÇʹÓõÄVC6.0¡£ÔÚÕâÀï±¾È˲»ÍƼöʹÓÃVC6.0¡£ÔÒòºÜ¼òµ¥£¬VC6.0ÒѾ¹ýʱÁË£¬ºóÃæµÄ°æ±¾±ÈVC6.0¸üÇ¿´ó·½±ã ......