#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char *p = "%host=3&ip=192.168.1.1&test";
char buff[128];
char *match;
match = strstr(p,"ip=");
if(match==0) printf("no match\n");
else {
sscanf(match,"ip=%s",buff);
sscanf(buff,"%[^&]",buff);
}
printf("%s\n",buff);
return 0;
}
运行结果:
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。