CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

printf int16

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








printf int16
PostPosted: Thu Jun 02, 2005 3:14 am     Reply with quote

Hi I want to send this:

int16 key;

key = 4000;

printf("%d",key);

why is that not working?
Ttelmah
Guest







PostPosted: Thu Jun 02, 2005 3:17 am     Reply with quote

'L'...
The int16, is a 'long' in CCS C, so the printf descriptor needs to be '%ld', to handle this.

Best Wishes
Guest








PostPosted: Thu Jun 02, 2005 8:09 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 8:14 am     Reply with quote

%ld is NOT sending the right information..
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Thu Jun 02, 2005 8:42 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jun 03, 2005 2:01 am     Reply with quote

3.224 (latest)
Ttelmah
Guest







PostPosted: Fri Jun 03, 2005 3:17 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jun 03, 2005 5:12 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group