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

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久久久亚洲AV片无码下载蜜桃| 久久精品国产一区二区电影| 久久久午夜精品| 国产精品九九久久免费视频| 看全色黄大色大片免费久久久| 婷婷久久综合九色综合九七| 精品99久久aaa一级毛片| 国产一区二区精品久久岳| 国产精品久久国产精品99盘| 亚洲综合精品香蕉久久网| 中文字幕精品久久| 欧美久久一级内射wwwwww.| 国产福利电影一区二区三区久久老子无码午夜伦不 | 麻豆精品久久久久久久99蜜桃| 乱亲女H秽乱长久久久| 久久久久国产一级毛片高清板| 久久久久亚洲av综合波多野结衣| 久久久精品一区二区三区| 久久亚洲AV成人无码软件| 青青久久精品国产免费看| 99久久精品免费看国产一区二区三区 | 日本强好片久久久久久AAA| 狠狠色丁香婷婷久久综合五月| 色综合久久最新中文字幕| 久久r热这里有精品视频| 国产精品无码久久综合| 青青热久久综合网伊人| 久久综合五月丁香久久激情| 久久av免费天堂小草播放| 精品国产一区二区三区久久蜜臀| 久久不见久久见免费影院www日本| 久久久精品一区二区三区| 亚洲国产香蕉人人爽成AV片久久| 亚洲一级Av无码毛片久久精品| 亚洲伊人久久成综合人影院| 久久精品中文字幕无码绿巨人| 国产精品一久久香蕉国产线看观看| 精品熟女少妇aⅴ免费久久| 97精品国产97久久久久久免费 | 无码任你躁久久久久久老妇| 欧洲精品久久久av无码电影|