#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

相关文章:

  • 2021-10-05
  • 2021-07-21
  • 2021-10-17
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-08
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案