We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hello,
I'm creating a parser to parse through data from UART. I managed to get it working with VS code and gcc but had a hard time implementing it in my initial keil project. Here's my code:
typedef struct device { int n; char MAC[12]; char name[20]; }device; void readlines(char *str,device* t) { const char s[5] = "\r\n"; char *token; int i = 0; token = strtok(str, s); while (token != NULL) { sscanf(token, "OK+DIS%d:%12cOK+NAME:%[^\0]\r\n", &t[i].n, t[i].MAC, t[i].name); token = strtok(NULL, s); i++; } }
%[^\0] is meant to include spaces in the t[i].name since sscanf consider \0 as a delimiter to the message, and %[^ ] doesn't work as intended. But I get always the same error unless I change %[^\0] by %[^ ] or something else. I have the <stdio.h> included by the way .Here's the error message: Error: L6218E: Undefined symbol _scanf_wctomb (referred from application.o).
Best regards.