前边带0的数字字符串与纯数字的相互转化

来源:互联网 发布:印度和中国的差距知乎 编辑:程序博客网 时间:2024/04/29 04:46
int vodtotalnumber = 0;TCHAR tchar_vodtotalnumber[MAX_PATH] = {0};itoa(vodtotalnumber,tchar_vodtotalnumber,10);int tchar_vodtotalnumberlen = strlen(tchar_vodtotalnumber);TCHAR tchar_vodtotalnumbertemp[MAX_PATH] = {0};//最后存放字符串"0000"strcpy(tchar_vodtotalnumbertemp,_T("0"));if(tchar_vodtotalnumberlen<4){while(tchar_vodtotalnumberlen<3){strcat(tchar_vodtotalnumbertemp,_T("0"));tchar_vodtotalnumberlen++;}strcat(tchar_vodtotalnumbertemp,tchar_vodtotalnumber);}
CStdString cs_vodnumbe = _T("0000");int vodnumber = atoi(cs_vodnumber.GetData());//vodnumber最后存放数字0
原创粉丝点击