编辑代码

#include <stdio.h>
#include <string.h>
int main () {
    char str[128]={0};
    char stripd[10]={0};
    unsigned int net_port=0;
    unsigned int ipt_len=0;
    char pdata[10]={0};
    strcpy(str,"+IPD,4,24:http://www.cmsoft.cn");
    sscanf(str,"+IPD,%d,%d:%s", &net_port, &ipt_len, pdata);
	printf("[sscanf] net_port: %d, len: %d, %s.\n", net_port, ipt_len, pdata);
	return 0;
}