sscanf函数原型:
int sscanf(conset char *str ,conset char *format ...);
功能:从str指定的字符串读取数据,并根据参数format字符串来转换并格式化数据
返回值:
成功:成功分割个数
失败:NULL
char str [1024] = "ABCDE12345"; //遇到空格或者\t结束忽略操作
char buf[1024] = {0};
sscanf(str,"%*[a-z]%s",buf);
printf("%s",buf);
char str [1024] = "12345abcde";
char buf[1024] = {0};
sscanf(str,"%[a-z]",buf);//此时输出为0,表明如果匹配失败会停止后面的匹配
printf("%s",buf);
标签:1024,sscanf,char,str,printf,buf
From: https://blog.csdn.net/xnglan/article/details/142727601