av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

C++ strtok應(yīng)用方式淺析

在C++編程語(yǔ)言中,對(duì)于字符的處理,可以通過(guò)使用C++ strtok來(lái)進(jìn)行具體的操作。那么正確的應(yīng)用方法我們將會(huì)在這篇文章中為大家詳細(xì)介紹,希望能對(duì)大家有所幫助,提高實(shí)際程序開(kāi)發(fā)效率。

C++ strtok原形如下:

 
 
 
  1. char *strtok(  
  2. char *strToken,  
  3. const char *strDelimit   
  4. ); 
 
 
 
  1. // crt_strtok.c  
  2. /**//* In this program, a loop uses strtok  
  3. * to print all the tokens (separated by commas  
  4. * or blanks) in the string named "string".  
  5. */  
  6. #include < string.h> 
  7. #include < stdio.h> 
  8. char string[] = "A string\tof ,,tokens\nand some more tokens";  
  9. char seps[] = " ,\t\n";  
  10. char *token;  
  11. int main( void )  
  12. {  
  13. printf( "Tokens:\n" );  
  14. /**//* Establish string and get the first token: */  
  15. token = strtok( string, seps );  
  16. while( token != NULL )  
  17. {  
  18. /**//* While there are tokens in "string" */  
  19. printf( " %s\n", token );  
  20. /**//* Get next token: */  
  21. token = strtok( NULL, seps );  
  22. }  

C++ strtok輸出:

 
 
 
  1. A  
  2. string  
  3. of  
  4. tokens  
  5. and  
  6. some  
  7. more  
  8. tokens 

Notes:

 
 
 
  1. Strtok(char *strToken, const char *strDelimit ) 

其中,strToken 和 strDelimit 一定要用字符數(shù)組格式的.也就是說(shuō).入口只能是字符數(shù)組元素地址。

以上就是對(duì)C++ strtok的相關(guān)介紹。

【編輯推薦】

  1. C++ replace()函數(shù)基本應(yīng)用方法總結(jié)
  2. C++ CreateThread參數(shù)具體應(yīng)用技巧解析
  3. C++托管程序?qū)崿F(xiàn)安全管理
  4. C++文件拷貝應(yīng)用技巧探討
  5. C++ kmp算法模板代碼解讀

網(wǎng)站欄目:C++ strtok應(yīng)用方式淺析
URL鏈接:http://uogjgqi.cn/article/dheccij.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們?cè)谖⑿派?4小時(shí)期待你的聲音

解答本文疑問(wèn)/技術(shù)咨詢/運(yùn)營(yíng)咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流