Help me convert a decimal number to ASCII string in C language

Status
Not open for further replies.

jjmcousineau

Newbie level 6
Joined
Feb 15, 2007
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,383
Hello,

I would like some help converting a decimal number into a string of ASCII characters in C language. For Example d120 would become '1' '2' '0'.
I am not a very good programmer and I cannot figure out how to go about separating each character.

Thank you for your help.

Jon
 

Re: Decimal to ASCII

Thanks but I am using CCS for PIC and do not have that function available to me.

Would you be able to tell me how it does that or of a function in ccs with that function?

Thanks

Jon
 

Decimal to ASCII

You can Create a Function of Your Own for that

You see you just need to add 48 decimal or 30h to convert a single digit from decimal to ascii character

And in reverse you subtract 30h

and for a Complete No, You Process it Digit by Digit

To get a digit at a time use Remaiders and Quotients and Divide till you are DONE

Hope U are to Click Helped Me with This Much
 

    jjmcousineau

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…