C×Ö·û´®³¤¶È¶¨Òå¹æ·¶
C×Ö·û´®³¤¶È¶¨Òå¹æ·¶
£¨×ªÔØÇë×¢Ã÷À´Ô´ÓÚ½ðÇìµÄרÀ¸£©
ÒòΪ×ÜÊǼûµ½C×Ö·û´®³¤¶ÈÏà¹ØµÄ´íÎó, ËùÓж¨¸ö¹æ·¶³öÀ´, ÓÐÀûÓÚ¼õÉÙ´íÎó.
¹Ø¼üÔÚÓÚC×Ö·û´®Óиö½áβ0, ´¦ÀíʱÐèҪעÒâ.
¶¨Òå×Ö·û´®³¤¶ÈÓÐÁ½ÖÖ·½Ê½, Ò»ÖÖÊÇÓÃ×Ö·û´®µÄ´óС, Ò»ÖÖÊÇ×Ö·û´®µÄ³¤¶È.
×Ö·û´®µÄ´óС¼´ÄÚ´æ¿Õ¼äµÄ´óС, ¶ø´®³¤¶È¼Ó1²ÅÊÇËùÐè¿Õ¼ä.
Àý “hello”¹²5¸ö×Ö·û£¬ÔÚÄÚ´æÕ¼6¸ö×Ö½Ú ×Ö·û´®³¤¶È5
Ò²¾ÍÊÇ˵sizeof()ºÍstrlen()µÄÇø±ð¡£
ÕýÈ·:
char str[MAX_SIZE];
char str[MAX_LEN + 1];
´íÎó:
char str[MAX_SIZE + 1];
char str[MAX_LEN];
Èçstrncpy()Ö®ÀàµÄº¯Êý´¦Àí×Ö·û´®Ê±, Èç¹ûҪʡÂÔ½áβ0ʱ, Ó¦ÈçÏÂ:
strncpy(dst, src, MAX_LEN);
»ò
strncpy(dst, src, MAX_SIZE - 1);
Ïà¹ØÎĵµ£º
½ø³ÌI/Oº¯Êý,Óëpcloseº¯ÊýÒ»ÆðʹÓá£
±íÍ·Îļþ
¡¡¡¡#include <stdio.h>
º¯Êý¶¨Òå
¡¡¡¡FILE * popen
( const char * command
, const char * type
);
¡¡¡¡int pclose
( FILE * stream
);
º¯Êý˵Ã÷
¡¡¡¡
popen() º¯Êýͨ¹ý´´½¨Ò»¸ö¹ÜµÀ£¬µ÷Óà fork ²úÉúÒ»¸ö×Ó½ø³Ì£¬Ö´ÐÐÒ»¸ö shell ÒÔÔËÐÐÃüÁîÀ´¿ªÆôÒ» ......
ÔÚLinuxÏÂд³ÌÐò£¬Óöµ½Ò»¸öº¯Êý²»ÖªµÀÔõôÓþ͵ÃÉÏÍøÈ¥²é£¬Ã»ÓÐÀàËÆMSDNÖ®ÀàµÄÈí¼þ£¬·³µÃºÜ¡£¿´µ½ÍøÉϺܶàÈ˶¼ËµÓÃmanºÜ·½±ã£¬Ö»ÒªmanÒ»ÏÂÄãÏëÁ˽âµÄº¯Êý¾ÍÐÐÁË£¬¿ÉÎÒÔÚmanÖ®ºóʲô¶¼µÃ²»µ½£¬±ÈÈç man printf£¬½á¹û¾ÍÊÇûÓÐÈë¿Ú
½ñÌìרÃÅÉÏÍøËÑÁËÏ£¬·¢ÏÖÔÀ´ÊÇÒòΪUbuntuĬÈÏûÓÐ×°manpages-dev£¬¶øº¯Êý¶¼ÔÚÕâ¸ö°üÀ°ÑÕ ......
±¾ÎÄÊ×·¢µØÖ·£ºhttp://blog.csdn.net/liigo/archive/2009/09/22/4582018.aspx
תÔØÇë×¢Ã÷³ö´¦£ºhttp://blog.csdn.net/liigo
×÷Õߣºliigo, 2009/09/22
¡¡¡¡ÔÚÏÂΧÆåʱ£¬µ±Ò»¸öÆå×ÓÂäµ½ÆåÅÌÉÏ£¬Ëü»á¶ÔÖÜΧ¶Ô·½Æå×ÓµÄËÀ»î²úÉúÓ°Ï죬Èç¹û¶Ô·½Æå×ÓûÓÐÆøÁË£¨ËÀÁË£©£¬±ØÐë´ÓÆåÅÌÉÏÄõô£¨Ìá×Ó£©¡£Õâ¸ö¹ý³ÌÌåÏÖµ½Î§ÆåÈí¼þÖУ¬¾ÍÐ ......
Precedence Operator Description Example Overloadable Associativity
1
::
Scope resolution operator
Class::age = 2;
no
none
2
()
()
[]
->
.
++
--
const_cast
dynamic_cast
static_cast
reinterpret_cast
typeid
Function call
Member initalization
Array access
Member access from ......
ÔÚ´óÐÍCÓïÑÔÏîÄ¿¹¤³Ì»òÕßlinuxÄÚºËÖÐÎÒÃǶ¼»á¾³£¼ûµ½Á½¸öFASTCALLºÍarmlinkage
Á½¸ö±êʶ·û(ÐÞÊηû)£¬ÄÇôËüÃǸ÷ÓÐʲô²»Í¬ÄØ£¿½ñÌì¾Í¸ø´ó¼Ò¹²Í¬·ÖÏíÒ»ÏÂ×Ô¼ºµÄÐĵÃ.
´ó¼Ò¶¼ÖªµÀÔÚ±ê×¼CϵÖк¯ÊýµÄÐβÎÔÚʵ¼Ê´«Èë²ÎÊýµÄʱºò»áÉæ¼°µ½²ÎÊý´æ·ÅµÄÎÊÌ⣬ÄÇôÕâЩ²ÎÊý´æ·ÅÔÚÄÄÀïÄØ£¿ ÓÐÒ»¶¨ÀíÂÛ»ù´¡µÄ ......