[SOLVED] ASCII to BCD converter code logic for changing number size

Status
Not open for further replies.

scorrpeio

Full Member level 5
Joined
Dec 26, 2006
Messages
286
Helped
10
Reputation
20
Reaction score
9
Trophy points
1,298
Activity points
3,496
I have to write a code to covert a number into its unpacked BCD format.

My function accepts the number (upto 32bit long) and the address of char array where its unpacked bcd need to be saved. The code is...


This code works absolutely fine.
However, the number which I will pass in the argument varies from 3digit to 12 digit.
Also, the numbers may need to be converted in format like XXX.XX

According to the number, the size of array (where its bcd is stored) varies.
For ex, for a number having 10digit, I will have array of size 10
But, for a number having 4 digit, I will have array of size 4 only.

So, this function may not work as it is for above conditions.
I can't imagine how to make this function serve these purposes.

---------- Post added at 07:44 ---------- Previous post was at 06:45 ----------

I have solved the issue.
 

when you solve a issue please mark the the thread SOLVED
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…