Jim Duffy wrote:
For example I need to convert a string like "3F" to an Int16 with a
value of 63


does this work?  it's probably close.  I didn't compile it or test it.

int hex_digit_to_int( char c )
{
        if ( TxtCharIsDigit( c ) )
                return c - '0';
        if ( TxtCharIsUpper( c ) )
                return c - 'A';
        return c - 'a';
}

long hex_string_to_int( const char *h )
{
        long i = 0;

        while ( *h ) {
                i <<= 4;
                i += hex_digit_to_int( *h );
                h++;
        }
        return i;
}

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

Reply via email to