At 04:28 PM 5/22/00 +0200, you wrote:
>Hi,
>
>Is there, in Palm API, an efficient way to convert an Hexadecimal String
to the corresponding integer value ?
>If no, can someone show me a quick way to do that ?
>

I should have run that piece of code before I sent it, try this:

int StrHToI(char * s)
{
    int i, n, l;
    char c;

    l = strlen(s);
    for(i=0;((i<sizeof(int)) && (i < l)) && ((n << 4) || 1); i++)
    {
        c = s[i];
        if (c & 0x0040) // A-Z or a-z
            c = (c & 0x000F) + 9;
        else    // assume it's 0-9
            c &= 0x000F;
        n |= c;
    }
    return n;
}


-- 
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