• <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 閱讀(535) 評論(0)  編輯 收藏 引用 所屬分類: C

            久久天天躁狠狠躁夜夜躁2014| 日韩人妻无码精品久久久不卡| 国产精品无码久久久久久| 伊人精品久久久久7777| 久久精品国产亚洲AV久| 欧美亚洲国产精品久久| 婷婷久久久亚洲欧洲日产国码AV| 伊人色综合久久天天人手人婷| 亚洲精品乱码久久久久久久久久久久 | 亚洲国产二区三区久久| 99久久国产综合精品成人影院| 久久久久亚洲AV成人网人人网站 | 亚洲国产精品久久66| 亚洲国产香蕉人人爽成AV片久久| 久久精品国产99国产精品导航| 精品久久久久久国产潘金莲| 国产一区二区精品久久岳 | 久久精品免费全国观看国产| 久久久精品人妻一区二区三区四 | 久久精品国产亚洲av日韩| 国产精品久久久久乳精品爆| 99久久精品免费看国产一区二区三区 | 久久66热人妻偷产精品9| 99久久国产亚洲高清观看2024| 少妇熟女久久综合网色欲| 免费观看成人久久网免费观看| 久久精品国产亚洲5555| 日韩久久久久久中文人妻| 国产精品99久久久久久www| 久久国产AVJUST麻豆| 国产成人精品久久亚洲| 欧美黑人又粗又大久久久| 久久一区二区三区免费| 久久久九九有精品国产| 久久久噜噜噜久久熟女AA片| 伊人久久大香线蕉综合5g| 久久99精品国产99久久| 久久99国产乱子伦精品免费| 77777亚洲午夜久久多人| 国产精品综合久久第一页| 国产Av激情久久无码天堂|