C++ 字符与数的转换
作者:互联网
- CString转换成int
int_16 = (int) wcstol(str_value,NULL,16);
int_10 = (int) wcstol(str_value,NULL,10);
int_8 = (int) wcstol(str_value,NULL,8);
- CString转换成float
float f=atof(str);
- char 转换成CString
转成16进制字符串
strValue.Formate(_T("%2x"),ch[i]);
转成10进制字符串
strValue.Formate(_T("%2d"),ch[i]);
转成8进制字符串
strValue.Formate(_T("%2o"),ch[i]);
浮点数转换成字符串
strValue.Formate(_T("%2.4f"),fvalue);
标签:字符,ch,转换,Formate,int,C++,strValue,str,wcstol 来源: https://blog.csdn.net/fwsylin/article/details/121016461