我要截取一段字符串,以固定的一个字符截取,应该这么做?

比如这一串字符beidou=123&to=11&content=111,我需要把=后面的数值截取出来,应该怎么做呢

只要对字符串遍历,字符x满足 x>=0x30且x<=ox39就取出。

char *str = "beidou=123&to=11&content=111,";
char buf[1024];
char *tmp;
int num = 0;
memcpy(buf, str, strlen(str));
buf[strlen(str)] = 0;
tmp = buf;
while((tmp = strstr(tmp, "=")))
{
if(sscanf(tmp, "=%d", &num) < 1 )
{
break;
}
tmp += 1;
printf("%d\n", num)
}