• <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è)計》,在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.

                看來用了靜態(tài)變量,還好有多線程的C運行庫,否則在多線程在有麻煩了。

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

            <2025年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

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

            網(wǎng)絡(luò)

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久亚洲AV成人无码软件| 欧美黑人激情性久久| 久久99国产精品成人欧美| 无码任你躁久久久久久| 亚洲午夜久久久久妓女影院| 2020最新久久久视精品爱| 久久精品综合网| 99久久伊人精品综合观看| 亚洲乱码精品久久久久..| 久久国产午夜精品一区二区三区| 久久亚洲AV无码西西人体| 久久av无码专区亚洲av桃花岛| 一本一道久久精品综合| 伊人久久大香线蕉av不卡| 久久综合日本熟妇| 久久国产精品无码网站| 青青青青久久精品国产h| 一本色道久久99一综合| 久久人人爽人人爽人人片AV东京热| 人妻精品久久无码专区精东影业 | 亚洲国产精品婷婷久久| 狠狠色婷婷久久一区二区| 久久国产精品免费一区| 青青青国产成人久久111网站| 久久er99热精品一区二区| 日韩乱码人妻无码中文字幕久久| 日韩AV毛片精品久久久| 国内精品久久久久久久影视麻豆| 国产精品久久一区二区三区| 性高朝久久久久久久久久| 7国产欧美日韩综合天堂中文久久久久 | 国内精品久久久人妻中文字幕| 欧美亚洲国产精品久久| 波多野结衣久久一区二区 | 久久久午夜精品福利内容| 久久中文精品无码中文字幕| 久久青青草原精品国产软件| 日本国产精品久久| 国产成人精品综合久久久久| 伊人久久久AV老熟妇色| 久久91综合国产91久久精品|