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

Search found 2 matches
CCS Forum Index
Author Message
  Topic: Printf decimal point on signed integers
bls

Replies: 2
Views: 3813

PostForum: General CCS C Discussion   Posted: Sat Sep 30, 2006 4:17 pm   Subject: Slightly tidier version...
Use ldiv instead of doing division and remainder separately; fix sprintf formatting so it actually works on CCS C:


void conv(signed long i, char *buf, int scale)
{
ldiv_t x;
i ...
  Topic: Printf decimal point on signed integers
bls

Replies: 2
Views: 3813

PostForum: General CCS C Discussion   Posted: Sat Sep 30, 2006 3:19 pm   Subject: Printf decimal point on signed integers
Something like this will work for your examples of scaling by 2, 5 and 10:


conv(int i, char *buf, int scale)
{
if (i != 0) {
if (i < 0) { *buf = ...
 
Page 1 of 1
All times are GMT - 6 Hours
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group