my_itoa

来源:互联网 发布:node.js和php区别 编辑:程序博客网 时间:2024/06/05 03:51
void _my_itoa(CHAR_T * desString , const unsigned int srcNum, const int arry_len)
{
        
        int num_len = 0;
        unsigned int tempNum = srcNum ;
        unsigned int tempNum_l = srcNum ;
        CHAR_T temp_arry [arry_len];
        
        memset(temp_arry, 0 , arry_len);
        
        while(1)
        {
            if(tempNum_l <= 0) break;
            num_len++;
            tempNum_l /= 10;
        }

        while(1)
        {
                num_len --;
            temp_arry[num_len ] = (CHAR_T)(tempNum % 10 + 48);
            tempNum /= 10;
        
            if(tempNum == 0) break;
        }

        memcpy(desString,temp_arry,strlen(temp_arry));
    
}
原创粉丝点击