int CtextcreatefileDlg::HexStrToint(const CString &m_HexStr)
{
int len=m_HexStr.GetLength(),result=0;
char ch;
for(int i=0;i<len;i++)
{
ch=(char)m_HexStr.GetAt(i);
if((ch<='F'&&ch>='A')||(ch>='0'&&ch<='9')||(ch<='f'&&ch>='a'))
{
if(ch<='9'&&ch>='0')
result=result*16+(ch-0x30);
else if(ch<='F'&&ch>='A')
result=result*16+(10+ch-'A');
else
result=result*16+(10+ch-'a');
}
else
return result;
}
return result;
}
十六进制转十进
最新推荐文章于 2021-11-18 20:07:50 发布