sprintf with SDK 17.1

I'm trying to get sprintf working with SDK 17.1.

Basically, I'm struggling getting this simply use-case to work.

char buf[32];
sprintf(buf, "%.3f", 3,5);

I'm not able to find a flag that enables this support.  Any assistant would be greatly appreciated.

  • Hi,

    Which compiler/IDE are you using?

    In Segger Embedded Studio, there is a project option to enable float support for printf:

    You also likely need to change your "float" from "3,5" to "3.5", comma is used to separate different parameters.

    I verified that the float in sprintf works in UART peripheral example in SES, with the above option set to "float".

    Best regards,
    Jørgen

Related