/**This routine converts numbers of type word to a string format of 0xXXXX===============================================================================**DESCRIPTION:***This routine converts numbers of type word to a string format of 0xXXXX in *decimal notation.*CALLING SEQUENCE: wordToDecStr(char *s, word n)**@param *s (character pointer of size + 1 or greater).@param n (16 bit word to be converted).@param size (char variable indicating number of leading zeros required).*\todo- List of things to do- Remove commented code*/void wordToDecStr(unsigned char *s, dword n,char size){ unsigned char i, j; dword temp; //return in error case if((size==0)) { return; } //fill with character zeros for (j=0;j<size;j++) { s[j] = '0'; } //modulus your way from the back to the front i=0; while ((n > 0)&&(size>i)) { temp=(n % 10) + '0'; ////<<<<ERROR OCCURS HERE s[size-i-1] =(char)temp; n /= 10; i++; }//end while s[size]='\0';//string terminator}//end wordToDecStr()
Solved! Go to Solution.