How can I de-escape my strings at run time?
Rich Salz
rsalz at bbn.com
Sat Jun 2 02:15:32 AEST 1990
Oops...
From: Kevin Braunsdorf <ksb at nostromo.cc.purdue.edu>
To: rsalz at BBN.COM
In article <2596 at litchi.bbn.com> you write:
| case 'x':
| for (*p = 0; *++text && isxdigit(*text); )
| if (isdigit(*text))
| *p = (*p << 4) + *text - '0';
| else if (isupper(*text))
| *p = (*p << 4) + *text - 'A';
| else
| *p = (*p << 4) + *text - 'a';
| text--;
| break;
Nope. You forgot to add 10 for the 'a' and 'A' case.
*p = (*p << 4) + *text - 'A' + 10;
else
*p = (*p << 4) + *text - 'a' + 10;
Sorry about that.
--
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.
More information about the Comp.lang.c
mailing list