View previous topic :: View next topic |
Author |
Message |
peachgirl Guest
|
a question: int16 printf |
Posted: Tue Jun 05, 2007 1:34 am |
|
|
int16 i=60000;
printf(lcd_putc, "%ld", i);
or printf(lcd_putc, "%LX",i);
I want to the result of print is 65535, But I can't |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Jun 05, 2007 1:50 am |
|
|
Strange. The code as shown should work.
What result is printed?
Which compiler version are you using? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Tue Jun 05, 2007 5:17 am |
|
|
'%ld', implies handling as a _signed_ value. You need to use '%lu' to handle values as an unsigned.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
peachgirl Guest
|
|
Posted: Wed Jun 06, 2007 1:02 am |
|
|
you are right! thank you
Ttelmah wrote: | '%ld', implies handling as a _signed_ value. You need to use '%lu' to handle values as an unsigned.
Best Wishes |
|
|
![](templates/subSilver/images/spacer.gif) |
|