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

            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            導航

            統計

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            設計模式 網絡編程

            網絡

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            2022年国产精品久久久久| 一本色道久久99一综合| 久久AAAA片一区二区| 青青草国产97免久久费观看| 欧美精品九九99久久在观看| 亚洲国产精品无码久久一线| 色综合久久中文综合网| 色婷婷久久久SWAG精品| 免费观看久久精彩视频| 午夜精品久久久久久99热| 久久精品9988| 久久久亚洲欧洲日产国码二区| 国产精品丝袜久久久久久不卡 | 国产69精品久久久久APP下载| 久久久精品2019免费观看| 久久精品国产AV一区二区三区 | 色妞色综合久久夜夜| 久久人人超碰精品CAOPOREN| 热久久这里只有精品| 狠狠色婷婷久久一区二区三区| 久久夜色精品国产亚洲| 欧美成人免费观看久久| 久久综合久久综合亚洲| 亚洲国产成人精品91久久久| 久久毛片免费看一区二区三区| 伊人久久无码精品中文字幕| 一本一道久久a久久精品综合| 久久青青草原精品国产不卡| 久久国产精品免费| 一本一本久久aa综合精品| 国产午夜精品理论片久久影视| 精品久久久久久国产91| 亚洲&#228;v永久无码精品天堂久久| 国产精品va久久久久久久| 99久久综合国产精品免费| 精品久久久久久久无码| 亚洲精品成人网久久久久久| 久久99国产精品久久99| 久久久亚洲欧洲日产国码二区| 一极黄色视频久久网站| 欧美久久久久久精选9999|