#include <stdlib.h>
#include <stdio.h>
int main()
{
char buf[64];
int rst = sscanf("[moudle],asdfasdf","[%[^]]",buf);
printf("%s,%d", buf, rst);
return 0;
#include <stdio.h>
int main()
{
char buf[64];
int rst = sscanf("[moudle],asdfasdf","[%[^]]",buf);
printf("%s,%d", buf, rst);
return 0;
}
输出结果
moudle,1