1. Discard the "0E" from the beginning of the string and if there is a 0(zero)at the end of the string discard that as well.
2. Reverse the digits of the string.
3. Convert the hexadecimal to 4 bit binary values starting from the right.
4. Concatenate the binary values and discard the 0's(zeros) which are at the beginning of binary string
5. Convert the binary values (7 bits) to hexadecimal values, according to the GSM 7-bit default alphabet(Hexadecimal).
6. Reverse the output of the above conversion.
Example (1). originatingAddress 0E146795E470'TBCD
Step1). 0E 146795E47 0'TBCD
Step2). 146795E47 ----Reverse the digits----> 74E597641
void reverse()
{
char* mystr="abcde";
char* temp1;
char* reverse;
int length=0,length1=0;
temp1=mystr;
//fetch the string length
while(*temp1 != NULL)
{
length++;
temp1++;
}
//assign memory to reverse based on actual string lenth
reverse=newchar[length];
//store charaters in reverse
while(length>0)
{
reverse[length1]=*--temp1;
length1++;
length--;
}
//store NULL at the last character
reverse[length1]='\0';
cout<<reverse;
}