• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Error

            #Error

            關于strtok函數

            #include <string.h>
            #include <stdio.h>

            int main(void)
            {
               char input[16] = "abc,dhh,eee";
               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);

               p = strtok(NULL, ",");
               if (p)   printf("%s\n", p);
               return 0;
            }

            MSDN上的原話:
            On the first call to strtok, the function skips leading delimiters and returns a pointer to the first token in strToken, terminating the token with a null character. More tokens can be broken out of the remainder of strToken by a series of calls to strtok. Each call to strtok modifies strToken by inserting a null character after the token returned by that call. To read the next token from strToken, call strtok with a NULL value for the strToken argument. The NULL strToken argument causes strtok to search for the next token in the modified strToken. The strDelimit argument can take any value from one call to the next so that the set of delimiters may vary.

            第二次參數竟然可以NULL
            是因為strtok中用static指針記住了上次處理后的位置

            我想是因為這個函數內部實現時,用到了靜態變量,而要不要修改這個變量,就是要根據第一個參數來確定!

            當為NULL時,就不再修改Static變量的值了!

            這個靜態變量的作用,就是記錄原始字符串的長度的!

            posted on 2009-10-07 19:14 Error 閱讀(534) 評論(0)  編輯 收藏 引用 所屬分類: C

            99久久婷婷国产综合亚洲| 97超级碰碰碰碰久久久久| 一级做a爱片久久毛片| 国产美女亚洲精品久久久综合| 国产免费久久精品丫丫| 亚洲国产精品综合久久网络| 亚洲精品美女久久777777| 久久精品国产亚洲网站| 国产成人精品久久综合| 国产福利电影一区二区三区久久老子无码午夜伦不 | 久久久久av无码免费网| 波多野结衣中文字幕久久| 精品久久香蕉国产线看观看亚洲 | 四虎国产精品成人免费久久| 色偷偷88888欧美精品久久久| 久久天堂电影网| 无码人妻精品一区二区三区久久久 | 久久久久国产视频电影| 久久精品国产亚洲av麻豆色欲| 少妇久久久久久被弄到高潮| 久久A级毛片免费观看| 久久福利片| 久久精品国产只有精品2020| 久久午夜福利电影| 久久久久国产一区二区| 狠狠精品久久久无码中文字幕| 91麻豆精品国产91久久久久久| 波多野结衣AV无码久久一区| 亚洲国产成人久久精品影视| 日本精品久久久久久久久免费| 久久国产精品波多野结衣AV| 伊人色综合久久天天人手人婷| 亚洲国产成人久久一区久久| 久久91精品国产91久久小草| 久久精品国产亚洲AV香蕉| 久久综合色区| 日韩美女18网站久久精品| 亚洲国产成人久久精品影视| 久久av无码专区亚洲av桃花岛| 久久国产亚洲精品无码| 亚洲国产成人久久综合一区77|