CÖ¸ÕëÒÜÏë
Ö¸Õë,ÖÚËùÖÜÖª,ʱΪһÄÚ´æµØÖ·.Å׿ªOS¼¶±ð»ò¸üµÍµÄÓ²¼þ¼¶±ð²»Ëµ,½ö¶ÔÓ¦ÓÃÄÚµÄʹÓýøÐÐССµÄÒܲâÌÖÂÛ.
Ê×ÏÈ,ÔÚÓ¦ÓÃÄÚ,ÓÃmallocÉêÇëµ½µÄÒ»¿éµØÖ·Ó¦¸ÃÊÇÁ¬ÐøµÄ(²Â²â,Âß¼ÉÏÁ¬Ðø,ʵ¼ÊÉÏÎïÀíÈçºÎ·Ö²¼²»Óè¹Ø×¢).
Æä´Î,Êý¾Ý´æÔÚÔÚÄÚ´æÖж¼ÊÇÒÔ2½øÖÆÐÎʽ´æ·Å.²»´æÔÚÊý¾ÝÀàÐÍ,Òò´Ë,¶ÔÄÚ´æÊý¾ÝµÄ²Ù×÷,Ö»Òª×ñѽø³öÀàÐÍÒ»Ö¼´¿É.
´Ë´¦µÄ½ø,ÊÇÖ¸½«Êý¾Ý´æ·Åµ½ÄÚ´æÖÐ,Èç´æ½øÒ»¸öintÐ͵ÄÊý¾Ý,¶ÁÈ¡µÄʱºò°´int¶ÁÈ¡¼´¿É,´æ´¢Ò»¸öchar*µÄÊý¾Ý,°´char*¶ÁÈ¡¼´¿É.
#define mAlloc(p,size)\
{\
errno=0;\
if((p=(char*)malloc(sizeof(char)*size)))==null){\
printf("malloc error[%d]\n",errno);\
exit(-1);\
}\
memset(p,0,sizeof(char)*size);\
}\
#define setInt(p,v) (*(int*)(p)=v)
#define setStr(p,v,size) strcpy(p,v)
int main()
{
char *p;
mAlloc(p,10);
setInt(p,100);
printf("int:%d\n",*(int*)p);
setStr(p+sizeof(int),"abc");
printf("str:%s\n",p+sizeof(int));
return 1;
}
Ïà¹ØÎĵµ£º
¼ÙÉèÓÐchar a[2];
ÈçÒª°Ñaת»»ÎªintÖµ¡£Ó¦ÊÇÈçÏÂд·¨int b=*(int *)a;
¼´£¬ÏÈ°ÑÖ¸Õëa ת»»ÎªÒ»¸öintÖ¸Õ룬ȻºóÔÙ´Ë»ù´¡ÉÏÈ¡Öµ¡£
µ«ÊÇÁíÒ»ÖÖд·¨ int b=(int)(*a);ÊDz»¶ÔµÄ£¬*a È¡aµÄÄÚ´æµ¥ÔªÄÚÈÝ£¬ÒòΪÏÖÔÚaÊÇcharÖ¸Õ룬ËùÒÔÖ»»áÈ¡a[1]ÖÐÄÚÈÝ£¬×î´óΪ255. ÕâÀïҪ˵Ã÷µÄÊÇ£¬ÔÚ°Ñchar»òbyteÊý×éת»»ÎªÆäËûÀàÐ͵Äֵʱ£¬ÒªÏÈ ......
ÉÏһƪÖÐÎÒÃÇÒѾÁ˽âÈçºÎÔÚPython³ÌÐòºÍCÄ£¿éÖ®¼ä½øÐÐÖµµÄÏ໥´«µÝ£¬ÏÖÔÚÎÒÃÇÀ´½øÈëʵ×÷½×¶Î£¬¿´¿´ÈçºÎ½«Ò»¸öCÓïÑÔ¿ª·¢µÄ¿ªÔ´mp3±à½âÂë¿âLAME°üװΪһ¸öPythonÏ¿ÉÒÔʹÓõÄÀ©Õ¹Ä£¿é¡£Ê×ÏÈÈ¥http://lame.sourceforge.net/download.phpÏÂÔØLAMEµÄÔ´´úÂ룬ȻºóÇл»µ½rootÓû§±àÒëÔ´´úÂ룬./configure
make
make instal ......
½ñÌì¿´K&RµÄÊéµÄʱºò˳±ãÎÂÏ°ÁËCµÄÁíÒ»ÖØÒªÊý¾Ý½á¹¹bit-fields£¬ÎÒÏëbit-fieldsÔÚ±àдµ×²ãÇý¶¯
Çý¶¯³ÌÐòµÄʱºòÓ¦¸Ã±È½ÏºÃÓã¬Ëü¿ÉÒÔÈÆ¿ª"&"ºÍ"|"½øÐÐλ²Ù×÷£¬¶øÇÒ¸ü¼Ó½ÚÔ¼ÄÚ´æ¿Õ¼ä¡£·Ï»°²»¶à˵
ÁË£¬»¹ÊÇÏÈÀ´¿´¿´ËüµÄÕæÃæÄ¿°É£º
bit-fieldÀ´Ô´:
bit-fieldÊÇΪÁ˽ÚÔ¼´æ´¢¿Õ¼ä¶ø´´ÔìµÄÒ»ÖÖÊý¾ ......
Óë &£º ÈκÎλÓÃ&ÔËËãÓë0½áºÏ½á¹ûΪ0£¬Óë1½áºÏ½á¹ûΪÆä±¾Éí£»
»ò | £º ÈκÎλÓÃ|ÔËËãÓë0½áºÏ½á¹ûΪÆä±¾Éí£¬Óë1½áºÏ½á¹ûΪ1£»
Òì»ò ^ £º ÈκÎλÓÃ^ÔËËãÓë0½áºÏ½á¹ûΪÆä±¾Éí£¬Óë1½áºÏÔòÈ¡·´£» ......
ÉèÖãº
1. Tools/Projects and Solutions/VC ++ Directories
Inlcude files: C:\Program Files\MATLAB\R2009a\extern\include
Library files: C:\Program Files\MATLAB\R2009a\extern\lib
2. Property
Configuration Properties/Linker
......