View previous topic :: View next topic |
Author |
Message |
Guest
|
printf int16 |
Posted: Thu Jun 02, 2005 3:14 am |
|
|
Hi I want to send this:
int16 key;
key = 4000;
printf("%d",key);
why is that not working? |
|
|
Ttelmah Guest
|
|
Posted: Thu Jun 02, 2005 3:17 am |
|
|
'L'...
The int16, is a 'long' in CCS C, so the printf descriptor needs to be '%ld', to handle this.
Best Wishes |
|
|
Guest
|
|
Posted: Thu Jun 02, 2005 8:09 am |
|
|
This is how I do this atm:
Code: | code1 = make8(key,0);
code2 = make8(key,1);
Printf("%cKEYS2%c%c",0xAA,code1,code2); |
|
|
|
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
|
Posted: Thu Jun 02, 2005 8:14 am |
|
|
%ld is NOT sending the right information.. |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Thu Jun 02, 2005 8:42 am |
|
|
Check the bug list on the CCS compiler pages. There have been versions which did not properly display %ld-ed strings.
What compiler version are you using? _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
|
Posted: Fri Jun 03, 2005 2:01 am |
|
|
3.224 (latest) |
|
|
Ttelmah Guest
|
|
Posted: Fri Jun 03, 2005 3:17 am |
|
|
Though it shouldn't 'matter' with only 4000, the correct printf string is '%lu', otherwise the results will go screwy over 32767. What is being displayed?.
Best Wishes |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Fri Jun 03, 2005 5:12 am |
|
|
Christophe wrote: | 3.224 (latest) | V3.225 was released May 27. Use the following link to subscribe for an email notification of new releases: http://www.ccsinfo.com/cgi-bin/email.cgi
From the 3.225 release notes:
3.225 Some formatting issues with %LD are fixed |
|
|
|