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

cº¯Êý: strtok ºÍ strtok_r

º¯ÊýÃû:   strtok    
  ¹¦     ÄÜ:   ²éÕÒÓÉÔÚµÚ¶þ¸ö´®ÖÐÖ¸¶¨µÄ·Ö½ç·û·Ö¸ô¿ªµÄµ¥´Ê    
  ÓÃ     ·¨:   char   *strtok(char   *str1,   char   *str2);    
  ³ÌÐòÀý:    
   
  #include   <string.h>    
  #include   <stdio.h>    
   
  int   main(void)    
  {    
        char   input[16]   =   "abc,d";    
        char   *p;    
   
        /*   strtok   places   a   NULL   terminator    
        in   front   of   the   token,   if   found   */    
        p   =   strtok(input,   ",");    
        if   (p)       printf("%s\n",   p);    
   
        /*   A   second   call   to   strtok   using   a   NULL    
        as   the   first   parameter   returns   a   pointer    
        to   the   character   following   the   token     */    
        p   =   strtok(NULL,   ",");    
        if   (p)       printf("%s\n",   p);    
        return   0;    
  }   
´øÓÐ_rµÄº¯ÊýÖ÷ÒªÀ´×ÔÓÚUNIXÏÂÃæ¡£ËùÓеĴøÓÐ_rºÍ²»´ø_rµÄº¯ÊýµÄÇø±ðµÄÊÇ:´ø_rµÄº¯ÊýÊÇḬ̈߳²È«µÄ£¬rµÄÒâ˼ÊÇreentrant,¿ÉÖØÈëµÄ¡£
ÉÏÊö³ÌÐòÔËÐеĽá¹ûÊÇ
abc
d
1. strtok½éÉÜ
ÖÚËùÖÜÖª£¬strtok¿ÉÒÔ¸ù¾ÝÓû§ËùÌṩµÄ·Ö¸î·


Ïà¹ØÎĵµ£º

C/C++Ò²¿ÉÒÔдµÄºÜ°²È«£¡

½ñÌì¿´µ½Ò»ÖֱȽϰ²È«µÄö¾Ùд·¨£¡
enum example
{
item1 = 0,
item2,
item3,
item4,
item5,
max      /* when you want to add element,please add before this */
};
        µ±ÄãʹÓÃËüµÄʱºò£º
example ex1;
        i ......

C¡¢C++ÓïÑÔµÄÎļþ²Ù×÷

½ñÌì¹éÄÉ×ܽáÒ»ÏÂÎļþ²Ù×÷º¯Êý¼°¸÷¸ö²ÎÊýµÄº¬Òå:
ÏȽéÉÜÒ»ÏÂc++µÄÎļþ²Ù×÷£¬ÎªÊ²Ã´Ëµc++µÄÎļþ²Ù×÷ÄØ£¬ÒòΪ¶ÔÓÚcÓïÑԵIJÙ×÷£¬Ò²ÓÐËüµÄº¯ÊýÖ®²»¹ý´óͬСÒì°ÕÁË¡£
  ÔÚc++µÄÎļþ²Ù×÷ÖÐÓУ¬ÓÐÒ»¸öÀà¶ÔÎļþ²Ù×÷½øÐвÙ×÷£¬¼´CFile£¬ÏÂÃæ¾Íдһ¶Î´úÂ룬À´¼òµ¥µÄ½øÐнéÉÜ¡£
 CFile cf;
 char zhi[]={1,2};
&n ......

³ÌÐòԱ֮·©¤©¤ÈçºÎѧϰCÓïÑÔ²¢¾«Í¨CÓï


×ªÔØ×Ô: http://bbs.chinaitlab.com/thread-304041-1-1.html
ѧϰCÓïÑÔ²»ÊÇÒ»³¯Ò»Ï¦µÄÊÂÇ飬µ«Ò²²»ÐèÒª»¨·ÑÊ®Äêʱ¼ä²ÅÄܾ«Í¨¡£ÈçºÎÒÔ×îСµÄ´ú¼Ûѧϰ²¢¾«Í¨CÓïÑÔÊDZ¾ÎĵÄÖ÷Ìâ¡£Çë×¢Ò⣬¼´Ê¹ÊÇ“×îСµÄ´ú¼Û”£¬Ò²¾ø²»ÊÇʲô½Ý¾¶£¬¶øÊÇÒÔ×î¶ÌµÄʱ¼äÈ¡µÃ×î¶àµÄÊÕ»ñ£¬Í¬Ê±Ò²Òâζ×ÅÄãÐèÒª¾­Àú¼è¿àµÄ¹ý³Ì¡£
Ò»¡¢Òª¶Á ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ