• <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

            欧美粉嫩小泬久久久久久久| 性欧美大战久久久久久久 | 色综合久久88色综合天天| 国产精品一区二区久久精品| 品成人欧美大片久久国产欧美| 久久久久久久亚洲精品| 无码人妻少妇久久中文字幕蜜桃 | 久久国产精品一国产精品金尊| av无码久久久久久不卡网站| 久久天天躁狠狠躁夜夜2020老熟妇| 精品国产乱码久久久久久人妻| 99久久无色码中文字幕| 久久国产免费直播| 精品久久久久久国产牛牛app| 国产偷久久久精品专区| 久久亚洲av无码精品浪潮| 国内精品久久久久影院优| 一级女性全黄久久生活片免费 | 久久久久久毛片免费播放| 久久精品国产99久久香蕉| 无码人妻精品一区二区三区久久| 色成年激情久久综合| 日韩乱码人妻无码中文字幕久久| 精品熟女少妇aⅴ免费久久| 国产精品天天影视久久综合网| 午夜精品久久久久| 日韩精品无码久久一区二区三| 99久久这里只有精品| 久久久精品2019免费观看| 日韩人妻无码精品久久免费一| 久久精品国产精品亚洲精品| 伊人久久大香线蕉综合网站| 精品无码久久久久久国产| 久久涩综合| 亚洲欧洲久久久精品| 无码精品久久一区二区三区 | 精品免费久久久久久久| 日产精品久久久一区二区| 久久婷婷国产综合精品 | 成人综合伊人五月婷久久| 亚洲精品国精品久久99热一|