Do u mean ,Converting a HexaDecimal Number into ASCII,
If that is the case , use the following function.
void ConvertToASCII(unsigned char number[],char getChar[],int length)<br />
{<br />
int index;<br />
char capitalLetter[30]= { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};<br />
char smallLetter[30] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; <br />
char numeric[11]={ '0','1','2','3','4','5','6','7','8','9'};<br />
int len;<br />
<br />
for( len = 0 ; len < length;len++)<br />
{<br />
if(number[len] >= 48 && number[len] <=57)<br />
{<br />
if ( number[len] == 48 )<br />
getChar[len] = numeric[0];<br />
else<br />
{<br />
index = number[len] - 48;<br />
getChar[len] = numeric[index];<br />
}<br />
}<br />
<br />
else if (number[len] >= 65 && number[len] <= 90)<br />
{<br />
if ( number[len] == 65 )<br />
getChar[len] = capitalLetter[0];<br />
else<br />
{<br />
index = number[len] - 65 ;<br />
getChar[len] = capitalLetter[index];<br />
}<br />
<br />
}<br />
else if ( number[len] >= 97 && number[len] <= 122)<br />
{<br />
if(number[len] == 97 )<br />
getChar[len] = smallLetter[0];<br />
else<br />
{<br />
index = number[len] - 97;<br />
getChar[len] = smallLetter[index];<br />
}<br />
}<br />
<br />
else<br />
{<br />
getChar[len] = '*';<br />
}<br />
} <br />
return; <br />
}
Appu..
"If you judge people, you have no time to love them."
|