https://baike.baidu.com/item/sscanf/10551550?fr=aladdin
巧用sscanf格式化,可以将字符串转换成数字
void main()
{
int result = 0;
char license_str[20] = "HAHA_AA_2233";
sscanf(license_str, "HAHA_AA_%u", &result);
printf("----- %d\n", result);
system("pause");
}
输出结果:
----- 2233
请按任意键继续. . .