I have a C++ function that converts a unsigned long into a 8 bit hex char string. I need to come up with a reverse function that takes a 8 bit hex char string and converts it into an unsigned integer representing it's bytes.
Original UINT -> char[8] method:
std::string ResultsToHex( unsigned int EncodeResults)
{
        std::cout << "UINT Input ==>";
        std::cout << EncodeResults;
        std:cout<<"\n";
        char _HexCodes[] = "0123456789ABCDEF";
        unsigned int HexAccum = EncodeResults;
        char tBuf[9];
        tBuf[8] = '\0';
        int Counter = 8;
        unsigned int Mask = 0x0000000F;
        char intermed;
        // Start with the Least significant digit and work backwards
        while( Counter-- > 0 )
        {
            // Get the hex digit
            unsigned int tmp = HexAccum & Mask;
            intermed = _HexCodes[tmp];
            tBuf[Counter] = intermed;
            // Next digit
            HexAccum = HexAccum >> 4;
        }
        std::cout << "Hex char Output ==>";
        std::cout << tBuf;
        std::cout << "\n";
        return std::string(tBuf);
    }
And here is the function I am trying to write that would take a char[8] as input and convert into a UINT:
 unsigned int ResultsUnhex( char tBuf[9])
{
        unsigned int result = 0;
        std::cout << "hex char Input ==>";
        std::cout << tBuf;
        std:cout<<"\n";
        //CODE TO CONVERT 8 char (bit) hex char into unsigned int goes here......
        //
        // while() {}
        //
        ///
        std::cout << "UINT Output ==>";
        std::cout << result;
        std::cout << "\n";
        return result;
    }
I am new to bit shifts, any help would be greatly appreciated :).
 
     
     
    