• <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 閱讀(2343) 評論(0)  編輯 收藏 引用 所屬分類: C++

            <2009年10月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            導航

            統計

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            設計模式 網絡編程

            網絡

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久久久亚洲av毛片大| 久久香综合精品久久伊人| 亚洲精品乱码久久久久久中文字幕| 国产农村妇女毛片精品久久| 一本色综合久久| 精品久久久久久久久午夜福利| 伊人久久综合热线大杳蕉下载| 人妻无码久久精品| 天天爽天天狠久久久综合麻豆| 久久久久久久尹人综合网亚洲| 久久人人爽人人爽人人片AV东京热| 国产免费久久精品99re丫y| 久久精品国产亚洲AV香蕉| 国产一级持黄大片99久久| 亚洲综合久久夜AV | 久久久久中文字幕| 久久综合给合久久狠狠狠97色69| 国产精品VIDEOSSEX久久发布| 久久天天躁夜夜躁狠狠| 国产高潮国产高潮久久久91| AV无码久久久久不卡蜜桃| 久久久久免费视频| 午夜不卡888久久| 久久精品国产亚洲av水果派| 美女久久久久久| 国产成人精品综合久久久| 久久九九有精品国产23百花影院| 国产亚洲精品久久久久秋霞| 久久99精品国产麻豆婷婷| av无码久久久久久不卡网站| 久久天天躁夜夜躁狠狠躁2022| 亚洲国产精品综合久久一线| 久久久久九九精品影院| 久久精品国产亚洲网站| 99久久精品午夜一区二区| 欧美熟妇另类久久久久久不卡| 中文精品99久久国产| 免费无码国产欧美久久18| 日日狠狠久久偷偷色综合96蜜桃 | 国产精久久一区二区三区| 久久国产亚洲高清观看|