sscanf遇到回车换行认为字符串结束,怎样让它忽略这些回车换行继续搜索整个字符串?
sscanf遇到空格继续?
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 5 6 char *c = "/o-ran-fm:alarm-notif/fault-id=(19)1 002"; 7 8 9 int main(int argc, char const *argv[]) 10 { 11 char k[128] = {0}; 12 char v[128] = {0}; 13 int t = -1; 14 15 sscanf(c, "%[^=]=(%d)%[^ ]", k, &t, v); // 遇到空格继续匹配 16 17 printf("k=%s ", k); 18 printf("v=%s ", v); 19 printf("t=%d ", t); 20 21 return 0; 22 }