At 04:28 PM 5/22/00 +0200, you wrote:
>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 ?
>
Should be something like this:
// assumes s is a valid hex string containing an int with no leading 0x
int StrHToA(char * s)
{
int i, n = 0;
for(i=0;i<sizeof(int) && (1 || (n << 4));i++)
{
c = s[i];
if (c & 0x0400) // 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/