日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
C++ strtok應(yīng)用方式淺析

在C++編程語言中,對(duì)于字符的處理,可以通過使用C++ strtok來進(jìn)行具體的操作。那么正確的應(yīng)用方法我們將會(huì)在這篇文章中為大家詳細(xì)介紹,希望能對(duì)大家有所幫助,提高實(shí)際程序開發(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ù)組格式的.也就是說.入口只能是字符數(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算法模板代碼解讀

文章題目:C++ strtok應(yīng)用方式淺析
URL鏈接:http://www.5511xx.com/article/dheccij.html