SPRINTF help??

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by deBoogle on Mon Aug 20 13:06:19 MST 2012
Hi guys,

I know there are a few threads on here regarding the sprintf function, but I'm not sure I am getting it!

I want to convert an integer to a string and i seem to remember using sprintf or snprintf to do this so... I include stdio.h
and then as a test:

uint8_t i = 50;
char buffer [20];

sprintf(buffer, "%d", i);

but i get the following error:

make: *** [TEST1.axf] Error 1

I now its probably a schoolboy error, but any help would be appreciated!

BTW, at the moment I am trying to avoid using the printf to UART mod, for two reasons 1) simplifying porting to other devices and 2) i may eventually want to use floats and I read that may not be possible with the printf to uart mod.

thanks in advance.