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

            伊人久久大香线蕉综合影院首页| 久久精品一区二区三区不卡| 国产精品久久新婚兰兰| 久久久久久综合网天天| 囯产极品美女高潮无套久久久 | 1000部精品久久久久久久久| 国产精品久久网| 亚洲第一永久AV网站久久精品男人的天堂AV | 久久久亚洲裙底偷窥综合| 丰满少妇高潮惨叫久久久| 狠狠色丁香婷婷综合久久来来去| 久久久久久久精品妇女99| 亚洲综合精品香蕉久久网97| 久久久久se色偷偷亚洲精品av| 日韩精品国产自在久久现线拍| 狠狠色噜噜色狠狠狠综合久久| 国产午夜电影久久| 国产美女久久久| 精品熟女少妇a∨免费久久| 日韩人妻无码一区二区三区久久99 | 久久天天躁狠狠躁夜夜avapp| 99热成人精品免费久久| 国产亚洲精品美女久久久| 久久婷婷五月综合色奶水99啪| 国产一区二区精品久久凹凸| 99久久无码一区人妻| 97久久超碰国产精品旧版| 99久久超碰中文字幕伊人| 久久久久久久久无码精品亚洲日韩 | 中文字幕精品久久| 亚洲美日韩Av中文字幕无码久久久妻妇 | 久久国产乱子精品免费女| 亚洲精品美女久久久久99小说| 97精品国产97久久久久久免费| 国产成人久久精品一区二区三区| 精品久久久无码人妻中文字幕| 久久久久亚洲?V成人无码| 久久精品亚洲乱码伦伦中文| 欧美日韩精品久久久免费观看| 嫩草影院久久99| 久久婷婷综合中文字幕|