16進数の文字列ターンUINT

uint32_t HexStr2Int(CStringの文字列)
{ 
    のuint32_t nRet = 0 int型 n始動= 0 ; 

    もし(str.Left(2).CompareNoCase(" 0X ")== 0 
        n始動 = 2 

    INT <; ++ I str.GetLength()I I = n始動
    { 
        場合(STR [I]> = ' 0 ' && STR [I] <= ' 9 ' 
            nRet = nRet * 16 + STR [I] - "0 " ;
        そう であれば(STR [I]> = ' A ' && STR [I] <= ' F ' 
            nRet = nRet * 16 + STR [I] - ' A ' + 10 そう であれば(STR [I]> = ' A ' && STR [I] <= ' F ' 
            nRet = nRet * 16 + STR [I] - ' ' + 10 他の
        {
            AfxMessageBox(" 無効進形式!" 、MB_OK);
            リターン - 1 
        } 
    } 
    戻り nRetと、

 

おすすめ

転載: www.cnblogs.com/Zoya-/p/12550241.html