View previous topic :: View next topic |
Author |
Message |
JerryR
Joined: 07 Feb 2008 Posts: 167
|
Number digits to ASCII |
Posted: Fri Oct 29, 2010 2:49 pm |
|
|
I know there's an elegant method to do this, but I'm in brain freeze.
I need to convert an int16 to a five element array containing the ASCII values for each of the five numerical digits. In other words:
53375= {35,33,33,37,35}, etc.
Anyone?
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Oct 29, 2010 3:01 pm |
|
|
The quick way is to use sprintf to convert the int16 to ASCII digits and
write to an array. It does it all for you.
Make sure you declare an that's big enough to hold all the digits,
and the string terminator byte at the end. Make the array big
enough to cover anything you might give it. |
|
|
Jerry R
Joined: 25 Apr 2007 Posts: 23
|
|
Posted: Fri Oct 29, 2010 5:05 pm |
|
|
Thanks PCM, I'll give it a try. I appreciate your reply and getting my brain back in gear!
Regards |
|
|
|