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

            天天久久狠狠色综合| 国产精品成人久久久| 久久婷婷五月综合97色一本一本| 亚洲国产精品无码成人片久久| 性欧美丰满熟妇XXXX性久久久 | 中文字幕精品无码久久久久久3D日动漫 | 伊人久久大香线焦AV综合影院 | 久久人人爽人人爽人人片AV东京热| 久久中文字幕视频、最近更新 | 狠狠狠色丁香婷婷综合久久五月| 久久精品免费大片国产大片| 亚洲精品国产字幕久久不卡| 精品久久久久久久中文字幕| 久久精品国产日本波多野结衣| 国产精品久久网| 久久人人爽人人爽人人片AV不| 99麻豆久久久国产精品免费| 久久久久久精品久久久久| 国产精品永久久久久久久久久| 蜜桃麻豆WWW久久囤产精品| 久久国产精品二国产精品| 久久久精品人妻一区二区三区四| 青青久久精品国产免费看| 色综合久久久久| 久久这里只有精品久久| 国产精品99精品久久免费| 欧美日韩精品久久免费| 亚洲&#228;v永久无码精品天堂久久 | 久久免费精品视频| 久久99国产精品一区二区| 久久久亚洲欧洲日产国码二区 | 久久久久亚洲AV无码观看 | 久久最新精品国产| 国产精品久久久久久搜索| 777米奇久久最新地址| 99999久久久久久亚洲| 99久久久精品免费观看国产| 久久精品中文无码资源站| 久久香综合精品久久伊人| 久久精品国产亚洲AV电影| 国产精品一久久香蕉国产线看 |