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

            導航

            統計

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            設計模式 網絡編程

            網絡

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            日韩人妻无码一区二区三区久久99| 99久久久国产精品免费无卡顿| 韩国三级中文字幕hd久久精品| 国产亚洲色婷婷久久99精品91| 亚洲国产精品无码久久九九| 久久久久亚洲av综合波多野结衣| 精品永久久福利一区二区 | 国产成人精品综合久久久| 色诱久久久久综合网ywww| 久久国产精品久久精品国产| 久久久久一本毛久久久| 久久99精品久久久久久久不卡| 久久精品国产清自在天天线| 久久久久久久97| 深夜久久AAAAA级毛片免费看| 久久精品国产亚洲av影院| 久久综合九色综合欧美就去吻| 欧洲成人午夜精品无码区久久| 国内精品久久久久久中文字幕| 人妻丰满AV无码久久不卡| 精品一久久香蕉国产线看播放| 久久精品a亚洲国产v高清不卡| 亚洲欧洲久久av| 久久久久亚洲AV成人网人人网站 | 欧美无乱码久久久免费午夜一区二区三区中文字幕 | 亚洲精品乱码久久久久久蜜桃| A狠狠久久蜜臀婷色中文网| 偷窥少妇久久久久久久久| 大香网伊人久久综合网2020| 亚洲国产另类久久久精品黑人| 精品久久人人爽天天玩人人妻| 久久精品国产99久久久| 97精品国产97久久久久久免费| 久久综合狠狠综合久久97色| 久久精品国产精品亜洲毛片| 草草久久久无码国产专区| 久久91综合国产91久久精品| 久久AV高清无码| www.久久热| 欧美精品一本久久男人的天堂| 狠狠色丁香久久婷婷综|