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

¹ØÓÚlinuxÄÚºËÖеÄ"__attribute__ ((packed))"

¹ØÓÚlinuxÄÚºËÖеÄ"__attribute__ ((packed))"  
À´Ô´£º
http://jimmy-lee.blog.hexun.com/8001013_d.html
__attrubte__ ((packed)) µÄ×÷ÓþÍÊǸæËß±àÒëÆ÷È¡Ïû½á¹¹ÔÚ±àÒë¹ý³ÌÖеÄÓÅ»¯¶ÔÆë,°´ÕÕʵ¼ÊÕ¼ÓÃ×Ö½ÚÊý½øÐжÔÆë¡£
#define __u8    unsigned char
#define __u16   unsigned short
/* __attribute__ ((packed)) µÄλÖÃÔ¼ÊøÊÇ·ÅÓÚÉùÃ÷µÄβ²¿“£»”֮ǰ */
struct str_struct{
        __u8    a;
        __u8    b;
        __u8    c;
        __u16   d;
} __attribute__ ((packed));
/*  µ±Óõ½typedefʱ£¬ÒªÌرð×¢Òâ__attribute__ ((packed))·ÅÖõÄλÖã¬Ï൱ÓÚ£º
  *  typedef struct str_stuct str;
  *  ¶østruct str_struct ¾ÍÊÇÉÏÃæµÄÄǸö½á¹¹¡£
  */
typedef struct {
        __u8    a;
        __u8    b;
        __u8    c;
        __u16   d;
} __attribute__ ((packed)) str;
/* ÔÚÏÂÃæÕâ¸ötypedef½á¹¹ÖУ¬__attribute__ ((packed))·ÅÔڽṹÃûstr_tempÖ®ºó£¬Æä×÷ÓÃÊDZ»ºöÂԵģ¬×¢ÒâÓë½á¹¹strµÄÇø±ð¡£*/
typedef struct {
        __u8    a;
        __u8    b;
        __u8    c;
        __u16   d;
}str_temp __attribute__ ((packed));
typedef struct {
        __u8    a;
        __u8    b;
        __u8    c;
        __u16   d;
}str_nopacked;
int main(void)
{
        printf("sizeof str = %d\n", sizeof(str));
      


Ïà¹ØÎĵµ£º

linux³£ÓÃcº¯Êý ÎļþȨÏÞ¿ØÖÆƪ

access£¨ÅжÏÊÇ·ñ¾ßÓдæÈ¡ÎļþµÄȨÏÞ£©
¡¡¡¡Ïà¹Øº¯Êý  stat£¬open£¬chmod£¬chown£¬setuid£¬setgid
¡¡¡¡±íÍ·Îļþ  #include<unistd.h>
¡¡¡¡¶¨Ò庯Êý  int access(const char * pathname,int mode);
¡¡¡¡º¯Êý˵Ã÷  access()»á¼ì²éÊÇ·ñ¿ÉÒÔ¶Á/дijһÒÑ´æÔÚµÄÎļþ¡£²ÎÊýmodeÓм¸ÖÖÇé¿ö×éºÏ£¬R_OK ......

Òƶ¯Linux×ÀÃæMeeGo 1.0·¢²¼






<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
A:link { so-language: zxx }
-->
    ´ó¼ÒÖªµÀ£¬
MeeGo
×ÀÃæµÄ×î´óÌصãÊÇʹÓÃ×ÔÓÉ£¨
free
use
£©£¬²»ÂÛÄãÔÚʲôµØ·½£¨Ê²Ã´¹ú¼Ò£©£¬Ò²²»ÂÛÄãÏëÓÃËü¸ÉʲôÊÂÇé¡£ÄÇô£¬
MeeGo
ÊDz»ÊÇÀ¬»ø´úÂëÄØ£¿µ±È»²»ÊÇ¡£ ......

linux¿ª»ú×Ô¶¯ÔËÐÐÉèÖÃ

ÔÚÍøÉÏ¿´µ½ÓÐÈË×ܽáµÃ²»´í
1£®¿ª»úÆô¶¯Ê±×Ô¶¯ÔËÐгÌÐò 
Linux
¼ÓÔغó, Ëü½«³õʼ»¯Ó²¼þºÍÉ豸Çý¶¯, È»ºóÔËÐеÚÒ»¸ö½ø³Ìinit¡£init¸ù¾ÝÅäÖÃÎļþ¼ÌÐøÒýµ¼¹ý³Ì£¬Æô¶¯ÆäËü½ø³Ì¡£Í¨³£Çé¿öÏ£¬Ð޸ķÅÖÃ
ÔÚ /etc/rc»ò /etc/rc.d »ò /etc/rc?.d Ä¿Â¼ÏµĽű¾Îļþ£¬¿ÉÒÔʹinit×Ô¶¯Æô¶¯Æ ......

ÈÃlinuxÖ§³Ögbk±àÂë


ÍøÉÏ¿´µ½µ½µÄ·½·¨£¬¼Ç¼ÒÔ±¸Óá£
ÔÚÓ¢ÎÄLocaleϵÄUbuntu
ÎÞ·¨Õý³£ÏÔʾXPÏÂGBK±àÂëµÄÖÐÎÄ
±à¼­/etc/environmentÎļþ
Ìí¼ÓLC_CTYPE="zh_CN.GBK"Ò»ÐÐ
ÈçÏÂ:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games"
LANG="en_US.UTF-8"
LANGU ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ