#include <stdio.h>
#include <string.h>
int main(){
    char str = "a =3,b=4,c=-1,d*e=12";
    char key[4] = {0};
    char value[4] = {0};
    const char *split = ",";
    char *p;
    p = strtok(str,split);
    while(p!=NULL){
        //printf("p=%s",p);
        sscanf(p,"%[^=]=%s",key,value);
        printf("key=%s\n",key);
        printf("value=%s\n",value);
        p=strtok(NULL,split);    
    }
    return 0;
}

  分析, =两边的为key和value

posted on 2015-01-30 15:02  snowdrop  阅读(170)  评论(0编辑  收藏  举报