PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 18, 2008 11:57 am |
|
|
Quote: |
char const otra[3][*]={
"Weight=%u Kg",
"Height= %u cm",
"Age= %u years"
};
void main(){
// Init LCD
....
printf(lcd_putc, otra[1], 185);
the message than I see in LCD is:
"Weight= %u Kg Height=185 cm"
|
You need to understand something about CCS. It's intended for small
embedded microcontroller chips, so because of that, the compiled code
is designed to be small.
Your example is based on the belief that CCS has a large run-time
module (such as MSCRT.DLL) that contains the entire printf parsing
mechanism. But it does not.
You are trying to pass the format string to printf at run-time. But CCS
doesn't parse the format string at run-time. It parses it at compile-time,
and creates a small, compact, specific code to handle the "%u" only.
If you also put in "%f", then it creates code for that too. But it's all
created at compile-time. It's hard-coded. |
|