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

sscanf float

Hi everyone,

I'm trying to use sscanf on my nordic device, and I get an issue with the following exemple (this same code works on my computer)

int d = 0;
float f = 0;
char s[] = "4.5 3";
char str[4];

sscanf(s, "%f %d", &f, &d);
//f = 6.5;  /* Set the variable manually */
sprintf(str, "float: %f integer: %d", f, d);
SEGGER_RTT_WriteString(0, str);

/* Print on screen: */
//float:  integer: 3     /* Using sscanf */
//float: 6.5 integer: 3  /* When the variable is set manually */

As you can see in this exemple the float number is not print on the screen, but when I set my float variable manually everything work well.

There is someone who has an idea for fix my issue ??

Thank.

Parents Reply Children
No Data
Related