void UnsignedToStr(unsigned int Value, char * pBuffer, int BufSize)
{
char OutStrBuf[32];
int Count = 0, i;
if(BufSize == 0) return;
do {
OutStrBuf[Count] = Value % 10 + '0';
Value = Value / 10;
Count++;
} while(Value);
if(BufSize < (Count + 1)) {/*"+1": include the terminate char */
Count = BufSize - 1;
}
for(i = 0; i < Count / 2; i++) {
char Temp;
Temp = OutStrBuf[i];
OutStrBuf[i] = OutStrBuf[Count - 1 - i];
OutStrBuf[Count - 1 - i] = Temp;
}
for(i = 0; i < Count; i++) {
pBuffer[i] = OutStrBuf[i];
}
pBuffer[Count] = 0x00; /* Append a terminate char */
}
二进制转十进制例程
原文作者:进制转换
原文地址: https://blog.csdn.net/binaryhead/article/details/7530829
本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
原文地址: https://blog.csdn.net/binaryhead/article/details/7530829
本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。