This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52840 Zephyr sscanf() issue

To parse information from strings I want to use sscanf().

Currently I have this small test program:

#include <stdio.h>
#include <stdint.h>

int main()
{
  char *pUrc = "+QIOPEN: 0,0";
  uint8_t  socket;
  uint32_t result;
  printf("sscanf(): %d -> socket: %u, result: %u\n", sscanf(pUrc, "+QIOPEN: %hhu,%u", &socket, &result), socket, result);

  return 0;
}

And in the prj.conf I have CONFIG_NEWLIB_LIBC=y defined.

This program produces two different outputs:
Zephyr:

sscanf(): 1 -> socket: 0, result: 3758157056

onlinegdb:
sscanf(): 2 -> socket: 0, result: 0

What is going on here? I would expect the second output, the one onlinegdb is producing.

Parents Reply Children
No Data
Related