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 support@ccsinfo.com

a question: int16 printf

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







a question: int16 printf
PostPosted: Tue Jun 05, 2007 1:34 am     Reply with quote

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
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Jun 05, 2007 1:50 am     Reply with quote

Strange. The code as shown should work.

What result is printed?
Which compiler version are you using?
Ttelmah
Guest







PostPosted: Tue Jun 05, 2007 5:17 am     Reply with quote

'%ld', implies handling as a _signed_ value. You need to use '%lu' to handle values as an unsigned.

Best Wishes
peachgirl
Guest







PostPosted: Wed Jun 06, 2007 1:02 am     Reply with quote

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
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