#include <stdio.h>
int main(void)
{
char *str = "hotline=100@192.168.5.179";
char buf[64] = {'\0'};
sscanf(str, "%*[^=]=%[^@]", buf);
printf("buf = %s\n", buf);
return 0;
}
结果:
dong@dong:~/demo/102314$ ./a.out
buf = 100