/*
num是要待转化的数字,pstr存储转换后的结果,size是预编制的序号长度,
如size = 4,那么结果就是0000,0001等
*/
void itoorder(const unsigned int num, char *pstr,const unsigned int size){
unsigned int tmp;
unsigned int i = size - 1;
int j = 0;
int count = 0;
tmp = num;
while ( tmp )
{
pstr[i--] = tmp % 10 + 48;
tmp = tmp / 10;
count++;
}
i = size - count;
if ( i >= 0 )
{
for( j = 0; j < i; ++j )
{
pstr[j] = '0';/* 多余空位填充为0 */
}
pstr[size] = '\0';
}
else
{
pstr[0] = '\0';
}
}