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

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

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

            <2010年8月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            導航

            統(tǒng)計

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            設計模式 網(wǎng)絡編程

            網(wǎng)絡

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久久黄片| 99久久中文字幕| 日韩欧美亚洲综合久久| 精品久久亚洲中文无码| 久久免费小视频| 中文字幕无码久久精品青草| 无码人妻少妇久久中文字幕蜜桃| 91精品国产色综合久久| 亚洲欧洲中文日韩久久AV乱码| 久久无码人妻一区二区三区午夜 | 韩国三级大全久久网站| 国产成人综合久久精品尤物| 久久天天躁狠狠躁夜夜不卡| 日本久久久精品中文字幕| 色妞色综合久久夜夜| 国产精品成人无码久久久久久| 婷婷伊人久久大香线蕉AV| 欧美精品一区二区久久| 久久久国产精品网站| 久久国产亚洲高清观看| 一级女性全黄久久生活片免费 | 亚洲综合久久综合激情久久| 无码国内精品久久综合88| 99热精品久久只有精品| 亚洲va中文字幕无码久久| 一本大道久久东京热无码AV| 久久久精品日本一区二区三区 | 精品久久久久久99人妻| 国产精品久久久久久| 7777久久亚洲中文字幕| 久久精品国产精品亚洲毛片| 久久久久久久波多野结衣高潮 | 欧美国产成人久久精品| 国产日韩久久久精品影院首页| 99re久久精品国产首页2020| 久久水蜜桃亚洲av无码精品麻豆| 伊人色综合久久天天网| 中文字幕久久波多野结衣av| 99精品久久精品一区二区| 欧美噜噜久久久XXX| 久久免费的精品国产V∧|