• <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è)計(jì)》,在Internet那章中看到如何在字符串中提取IP地址,特地標(biāo)記一下:
            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運(yùn)行庫(kù),否則在多線程在有麻煩了。

            posted on 2009-10-19 23:05 gewala 閱讀(2335) 評(píng)論(0)  編輯 收藏 引用 所屬分類: C++

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

            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

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

            網(wǎng)絡(luò)

            搜索

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            亚洲午夜久久久| 99久久精品费精品国产| 无码日韩人妻精品久久蜜桃 | 办公室久久精品| 国产精品狼人久久久久影院| 亚洲日本久久久午夜精品| 久久人人爽人人爽人人片av高请| 一级做a爰片久久毛片人呢| 久久久久久国产精品美女 | 国产成人精品综合久久久久| 久久久久国产一级毛片高清版| 色综合久久天天综线观看| 777米奇久久最新地址| 偷偷做久久久久网站| 久久婷婷五月综合色奶水99啪 | 国产美女久久久| 99久久综合国产精品免费| 国产成人精品久久亚洲高清不卡| 亚洲精品国产字幕久久不卡| 久久精品女人天堂AV麻| 久久se精品一区精品二区| 色欲综合久久中文字幕网| 色婷婷狠狠久久综合五月| 久久99精品国产麻豆蜜芽| 精品久久一区二区| 久久久久AV综合网成人| 亚洲午夜无码久久久久| 99精品国产99久久久久久97 | 国产精品99久久久久久董美香| 久久午夜无码鲁丝片| 亚洲午夜久久久久久噜噜噜| 久久人人爽人人爽人人片AV东京热| 精品久久久无码中文字幕| 9191精品国产免费久久| 亚洲精品国产成人99久久| 99久久国产亚洲高清观看2024| 久久久久国产精品| 久久精品国产精品亚洲下载| 国产成人久久久精品二区三区| 国内精品久久久久久久涩爱| 久久WWW免费人成—看片|