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

            国内精品久久九九国产精品| 久久精品国产一区二区三区| 欧美喷潮久久久XXXXx| 久久亚洲精品无码AV红樱桃| 久久国产高清字幕中文| 久久久久国产| 日韩精品久久久久久久电影蜜臀| 国产美女久久久| 久久综合给合综合久久| 精品久久久无码人妻中文字幕豆芽| 精品免费tv久久久久久久| 日本精品久久久久久久久免费| 欧美大香线蕉线伊人久久| 久久综合九色综合久99| 好久久免费视频高清| 久久无码国产专区精品| 天天综合久久久网| 午夜人妻久久久久久久久| 久久精品国产精品亚洲人人| 无码精品久久久天天影视| 欧美久久亚洲精品| 国产精品99久久不卡| 久久亚洲精品人成综合网| 久久久久se色偷偷亚洲精品av| 99久久精品费精品国产| 国内精品久久久久影院免费| 亚洲午夜久久久久久噜噜噜| 性做久久久久久免费观看| 国产午夜精品理论片久久| 国产精品久久网| 国产精品9999久久久久| 久久综合给久久狠狠97色| 精品一二三区久久aaa片| 日本国产精品久久| 久久精品国产清自在天天线| 国产激情久久久久影院老熟女免费 | 中文精品久久久久国产网址| 7777久久亚洲中文字幕| 99久久婷婷免费国产综合精品| 久久精品国产亚洲AV香蕉| 色综合久久中文字幕无码|