字符串拆分

来源:互联网 发布:深圳淘宝托管公司 编辑:程序博客网 时间:2024/04/17 07:34

 再vc语言中
char pBuffer[128];
sprintf(pBuffer,"Do you,Believe,the rule/r/nHehe,I,DO/r/n");
char* token;
token = strtok(pBuffer,",/r/n"); 
while (token != NULL){
AfxMessageBox(token);
//You Can Add token to your Array ^_^
token = strtok(NULL,",/r/n");
}

输出结果Do you

                Believe

                the rule

              Hehe

             I

           DO