Quantcast
Channel: Forum - Recent Threads
Viewing all articles
Browse latest Browse all 5781

S1 - snprintf does not work with float.

$
0
0

Hello,

    i am working with a project on a S1 MCU and I figured out that the "snprintf" function does not work with float.

Try this dummy code:

#include "new_thread0.h"
#include "stdio.h"


void new_thread0_entry(void);

/* New Thread entry function */
void new_thread0_entry(void)
{
    char tmp[100];

    while (1)
    {
         float a = 25.2;
         snprintf( tmp, 100, "%f4.2", a );
         tx_thread_sleep (1);
    }
}

The resulting "tmp" array is completly wrong.

Am i doing anything wrong?


Viewing all articles
Browse latest Browse all 5781

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>