• <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久久99精品免视看动漫| 精品一区二区久久| 久久97久久97精品免视看| 亚洲&#228;v永久无码精品天堂久久 | 99久久精品免费看国产一区二区三区| 亚洲色婷婷综合久久| 99久久亚洲综合精品网站| 国产精品久久新婚兰兰| 国产精品久久久久久福利69堂| 久久久久亚洲av毛片大 | 久久亚洲高清观看| 婷婷久久综合九色综合九七| 久久99久久99精品免视看动漫| 人妻丰满?V无码久久不卡| a高清免费毛片久久| 亚洲国产精品一区二区久久hs| 久久艹国产| 国产精品欧美久久久久天天影视| 无码国内精品久久人妻| 欧美久久综合九色综合| 久久久久中文字幕| 久久久久亚洲AV成人片| 一本色道久久综合亚洲精品| 欧美性大战久久久久久| 久久精品二区| 国产视频久久| 久久99精品九九九久久婷婷| 婷婷久久综合九色综合98| 97久久精品无码一区二区| 香蕉久久夜色精品升级完成| 精品国产青草久久久久福利| 国产成人综合久久精品红| 香蕉久久夜色精品国产2020| 香蕉99久久国产综合精品宅男自 | 青青草原综合久久大伊人| 久久人人爽人人爽AV片| 无码国内精品久久人妻麻豆按摩| 久久中文字幕无码专区| 色妞色综合久久夜夜| 亚洲va中文字幕无码久久不卡|