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

            strtok用法--提取字符串

                最近看Petzold的《windows程序設計》,在Internet那章中看到如何在字符串中提取IP地址,特地標記一下:
            1 GetDlgItemTextA (hwnd, wServer, szLabel, sizeof (szLabel));
            2 strtok (szLabel, "(");
            3 strcpy (szServer, strtok (NULL, ")"));
                在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.

            Warning    Each of these functions uses a static variable for parsing the string into tokens. If multiple or simultaneous calls are made to the same function, a high potential for data corruption and inaccurate results exists. Therefore, do not attempt to call the same function simultaneously for different strings and be aware of calling one of these function from within a loop where another routine may be called that uses the same function.  However, calling this function simultaneously from multiple threads does not have undesirable effects.

                看來用了靜態變量,還好有多線程的C運行庫,否則在多線程在有麻煩了。

            posted on 2009-10-19 23:05 gewala 閱讀(2335) 評論(0)  編輯 收藏 引用 所屬分類: C++

            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            導航

            統計

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            設計模式 網絡編程

            網絡

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品国产男包| 天天久久狠狠色综合| 99久久精品国产毛片| 久久99久久99小草精品免视看| 亚洲国产精品无码久久久秋霞2 | 久久国产高清一区二区三区| 精品免费tv久久久久久久| 狠狠狠色丁香婷婷综合久久俺| 精品精品国产自在久久高清| 久久国产精品99久久久久久老狼| 99久久婷婷国产综合精品草原| 国产福利电影一区二区三区,免费久久久久久久精 | 国产99久久久久久免费看| 久久久久久国产精品美女| 久久精品国产99国产精品亚洲| 久久精品人人做人人爽97| 久久免费视频网站| 一级a性色生活片久久无| 奇米综合四色77777久久| 久久精品一区二区国产| 久久人妻少妇嫩草AV无码蜜桃| 久久午夜无码鲁丝片秋霞| 久久精品无码一区二区无码| 国产精品久久久久一区二区三区| 久久伊人五月天论坛| 日产精品久久久久久久性色| 久久久精品日本一区二区三区| 久久国产欧美日韩精品免费| a高清免费毛片久久| 亚洲欧美国产精品专区久久| 国产精品福利一区二区久久| 精品国产乱码久久久久软件| 国内精品久久九九国产精品| 一本色道久久综合| 国产一区二区精品久久岳| 久久久久久国产精品无码超碰| 色婷婷久久久SWAG精品| 国产成人精品久久亚洲高清不卡 | 久久天天躁狠狠躁夜夜网站| 亚洲人AV永久一区二区三区久久| 久久亚洲国产精品一区二区|