• <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日韩AV永久无码久久| 久久久久久久久久久久久久| 久久天天躁狠狠躁夜夜网站| 久久久亚洲裙底偷窥综合| 99久久99这里只有免费费精品| 久久久精品免费国产四虎| 国产精品99久久不卡| 麻豆精品久久久久久久99蜜桃| 69SEX久久精品国产麻豆| 亚洲欧美成人久久综合中文网| 9久久9久久精品| 久久久黄色大片| 日韩亚洲欧美久久久www综合网 | 亚洲精品无码久久久影院相关影片 | 国产精品岛国久久久久| 日韩精品久久久久久久电影| 久久久无码一区二区三区| 久久久久99精品成人片| 91久久精品国产91性色也| 综合久久一区二区三区| 亚洲国产天堂久久综合网站| 狠狠色婷婷久久一区二区三区| 久久人与动人物a级毛片| 伊人久久综在合线亚洲2019| 中文字幕人妻色偷偷久久| 亚洲国产成人精品久久久国产成人一区二区三区综| 久久人妻少妇嫩草AV蜜桃| 亚洲午夜精品久久久久久app| 精品久久久久久无码人妻热| 99久久99久久久精品齐齐 | 精品国产青草久久久久福利| 99久久国产综合精品五月天喷水 | 无码人妻精品一区二区三区久久久 | 思思久久99热只有频精品66| 国产三级精品久久| 久久婷婷久久一区二区三区| 久久国产一区二区| 久久精品草草草| 国产精品日韩深夜福利久久|