Hi,

Someone post this routine below to convert a Hex to an Int. It worked fine,
but it seem to convert only the first 4 digits supplied.

Say i wish to convert 35A4E900 , it only converts 35A4. Anyone any idea
how to get it to convert all 8 chars?

int StrHexToInt(const char* pszHex)
{
    int nResult = 0;
    for (int i = 0; *pszHex && (i < (sizeof(int) << 1)); i++)

    {                
        nResult <<= 4;
        char c = *pszHex++;
        if ((c & 0xF0) == 0x30)
            nResult |= (c & 0x0F);
        else
            nResult |= ((c & 0x0F) + 9);
    }
    return (nResult);
}

Thanks!

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to