AnsweredAssumed Answered

Cosmic STM8 sprintf

Question asked by maurosmartins on Sep 26, 2017
Latest reply on Sep 27, 2017 by maurosmartins

Hello all!


I'm using stvd and Cosmic (free) C compiler and I'm having issues with a simple statement. I'm using sprintf to conver two uint8_t to string but it always do it wrong. 


uint8_t u8Hours = 22, u8Minutes = 31;

uint8_t u8DisplayBuffer[6];


sprintf(u8DisplayBuffer, "%.2u%.2u", u8Hours, u8Minutes );


the result is an array with "5663" 

Sprintf Error###


I have tried everything on my mind but I can't figure it out what is happening, do you have some idea what can be wrong?


Thanks in advanced,

Best regards, Mauro.