C语言处理分隔字符串
//char *strtok(char *,char *);
Action()
{
extern char * strtok(char * string, const char * delimiters );
charaBuffer[256];
char*cMan;
charcSeparator[] = ",";
inti;
charman[4][20];
lr_save_string("test1,test2,test3,test4","pman");
strcpy(aBuffer,lr_eval_string("{pman}"));
lr_output_message("测试人员:%s",aBuffer);
lr_output_message("=====================================");
cMan=strtok(aBuffer,cSeparator);
i=1;
if(!cMan) {
lr_output_message("没有人员");
return-1;
}else{
while(cMan !=NULL) {
strcpy(man[i],cMan);
cMan=strtok(NULL,cSeparator);
i++;
}
lr_output_message("测试1:%s",man[1]);
lr_output_message("测试1:%s",man[2]);
lr_output_message("测试1:%s",man[3]);
lr_output_message("测试1:%s",man[4]);
}
return0;
}