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

FYI: printing int32 undocumented

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







FYI: printing int32 undocumented
PostPosted: Sun Apr 20, 2003 3:46 pm     Reply with quote

I want to keep a running total that may exceed 32k. CCS manual indicates a valid type of INT32 (4byte integer).
In a printf(), \%Lu is for 16bit unsigned.
As it turns out, it works for int32 signed and unsigned.
int32 count;
count = 79999;
printf("\%08Lu",count); OR

signed int32 count;
count = -85000;
printf("\%\%08Ld",count);
___________________________
This message was ported from CCS's old forum
Original Post ID: 13837
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

Re: FYI: printing int32 undocumented
PostPosted: Sun Apr 20, 2003 4:20 pm     Reply with quote

:=I want to keep a running total that may exceed 32k. CCS manual indicates a valid type of INT32 (4byte integer).
:=In a printf(), \%Lu is for 16bit unsigned.
:=As it turns out, it works for int32 signed and unsigned.
:=int32 count;
:=count = 79999;
:=printf("\%08Lu",count); OR
:=
:=signed int32 count;
:=count = -85000;
:=printf("\%\%08Ld",count);

Perhaps you have an early version of the manual.
It's in the manual I have dated September 2002, also in the one dated July 2001, and in the on screen help of IDE ver. 3.28 (PCM ver. 3.150):
"Longs in the printf may be 16 or 32 bit"
Regards
Kenny
___________________________
This message was ported from CCS's old forum
Original Post ID: 13839
david smith
Guest







Re: FYI: printing int32 undocumented
PostPosted: Sun Apr 20, 2003 10:30 pm     Reply with quote

:=Perhaps you have an early version of the manual.
Yup, mine's earlier, though the compiler is new.
Thanks.
___________________________
This message was ported from CCS's old forum
Original Post ID: 13852
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