用sscanf来分割字符串,比strchr好用!
int getstr(char *str,char ret[][20],int chr)
{
char *pstr,*p;
int i = 0;
pstr = str;
while(1)
{
p = strchr(pstr,chr);
if(p)
{
memcpy(ret[i],pstr,(p-pstr));
ret[i++][p-pstr] = 0;
}
else
{
strcpy(ret[i++],pstr);
break;
}
pstr = ++p;
}
return i;
}