字符串分割:
使用的标志符可以自己定义,本例中使用的是“/”
void spliter(){
char pBuffer[128];
sprintf(pBuffer,"how/are/you/fine/thank/you");
char* token;
token = strtok(pBuffer,"/");
while (token != NULL){
AfxMessageBox(token);
//You Can Add token to your Array ^_^
token = strtok(NULL,"/");
}
}
运行结果:
how
are
you
fine
thank
you