This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sscanf() string + int

Hello,

I am trying to use sscanf() to format an input string into an integer, followed by a string, followed by an integer.  For example:

int main(){
  #define FORMAT_STR   "RESPONSE: %u,%[^,],%u"

  char *p_input_str = "RESPONSE: 27,\"open\",2";
  uint32_t count;
  uint32_t status;
  char buffer[10];

  uint8_t num_args = sscanf(p_input_str, FORMAT_STR,  &count, buffer, &status);
  printf("Got %d args, count=%d, status=%d\n", num_args, count, status);
  return 0;
}

This works great with as a standalone c program, and the output is:

Got 3 args, count=27, status=2



But when I implement this in my Nordic / SES application, num_args is set to 1 instead of 3.  Does the sscanf() not support the "^" format specifier?

Related