sprintf

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sprintf

2,456 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by eicmeters on Fri Feb 11 21:42:44 MST 2011
hi....

I have a problem in LPCXpresso software, if i give "sprintf" statement its displaying error.Plz sort out this issue.
........
.......
sprintf(array,"%d",value);
.......
......

REG,
Deepak Shetty
0 Kudos
Reply
7 Replies

2,033 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Jul 03 00:02:00 MST 2012

Quote: 24h_newload
I miss this step: you need to provide your own implementations of the function __write()

"your own implementations" - I don't see this mean ! pls to me clearly about that ?




Did you read #2 of http://knowledgebase.nxp.com/showthread.php?t=2887 already?
0 Kudos
Reply

2,033 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Mon Jul 02 23:11:42 MST 2012

Quote: 24h_newload
I've already read this

http://support.code-red-tech.com/CodeRedWiki/UartPrintf

but I still can't retarget for uart funtion. I can not use printf funtion like you.


I miss this step: you need to provide your own implementations of the function __write()

"your own implementations" - I don't see this mean ! pls to me clearly about that ?

Thanks so much !

P/s: Im programming for LPC11xx.




Hi...!!!

Can you please share your code with all the header files, and the error on your IDE console.


Thanks & Regards....:)
0 Kudos
Reply

2,033 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 24h_newload on Mon Jul 02 22:01:29 MST 2012
I've already read this

http://support.code-red-tech.com/CodeRedWiki/UartPrintf

but I still can't retarget for uart funtion. I can not use printf funtion like you.


I miss this step: you need to provide your own implementations of the function __write()

"your own implementations" - I don't see this mean ! pls to me clearly about that ?

Thanks so much !

P/s: Im programming for LPC11xx.
0 Kudos
Reply

2,033 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Sep 29 07:12:05 MST 2011

Quote: SloandStedE
Having to use semihosting libraries seems appropriate for printf(), but it doesn't seem to apply to sprintf() which is simply a string formatting function with no IO.



You can use sprintf when linking with either the semihost or the nohost variant of Redlib. How to change the currently selected library variant is covered here:

http://support.code-red-tech.com/CodeRedWiki/SwitchingCLibrary

Regards,
CodeRedSupport
0 Kudos
Reply

2,033 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Sep 29 04:54:44 MST 2011
Is this a question ?

My sprintf is still working (semihosting) :eek:

#include <stdio.h>

int main(void)
{
 printf("Hello World\n");
 volatile static int i = 1234 ;
 char text1[50];

 sprintf(text1,"Value is %06d",i);
 printf("Text1: %s\n",text1);
 while(1)
 {
  i++ ;
 }
 return 0 ;
}
0 Kudos
Reply

2,033 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by SloandStedE on Thu Sep 29 04:14:49 MST 2011
Having to use semihosting libraries seems appropriate for printf(), but it doesn't seem to apply to sprintf() which is simply a string formatting function with no IO.
0 Kudos
Reply

2,033 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Sat Feb 12 10:00:11 MST 2011
What error?

Did you read this? http://support.code-red-tech.com/CodeRedWiki/UsingPrintf
0 Kudos
Reply