1. 代码
char data[] = "num0=12&num1=34&ip=192.168.1.100&sub=255.255.255.0&gw=192.168.1.1";
char* key;
char* value = NULL;
char* token;
char* next_token = NULL;token = strtok_s(data, "&", &next_token);
while (token != NULL) {key = strtok_s(token, "=", &value);printf("key:%s value:%s\n", key, value);// 获取下一个键值token = strtok_s(NULL, "&", &next_token);
}