• <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程序設(shè)計》,在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++

            <2025年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            設(shè)計模式 網(wǎng)絡(luò)編程

            網(wǎng)絡(luò)

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久高潮一级毛片免费| 久久亚洲精品中文字幕| 国内精品久久久久伊人av| 深夜久久AAAAA级毛片免费看| 久久久91精品国产一区二区三区| 久久成人小视频| 久久人妻AV中文字幕| 亚洲精品无码久久一线| 久久综合久久美利坚合众国| 精品综合久久久久久97| 日韩人妻无码精品久久免费一| 99久久精品国产一区二区 | 久久伊人五月天论坛| 久久精品国产清自在天天线| 国产精品永久久久久久久久久| 久久激情亚洲精品无码?V| 色婷婷久久久SWAG精品| 久久亚洲日韩看片无码| 人妻无码αv中文字幕久久| 久久久久久亚洲Av无码精品专口 | 亚洲一区精品伊人久久伊人 | 人妻少妇久久中文字幕| 99国产精品久久| 国产精品青草久久久久福利99 | 久久久精品视频免费观看| 午夜福利91久久福利| 久久夜色精品国产网站| 久久综合狠狠综合久久激情 | 久久人人爽人人精品视频| 久久人妻无码中文字幕| 久久精品国产只有精品2020| 热久久国产欧美一区二区精品| 99精品久久久久久久婷婷 | 亚洲国产欧洲综合997久久| 久久91精品国产91久久小草| 国产精品免费久久| 看久久久久久a级毛片| 日韩美女18网站久久精品| 国产亚洲欧美精品久久久| 久久毛片一区二区| 久久成人精品视频|