home *** CD-ROM | disk | FTP | other *** search
- From: rsalz@bbn.com (Rich Salz)
- Newsgroups: comp.lang.c,alt.sources
- Subject: Re: How can I de-escape my strings at run time?
- Message-ID: <2598@litchi.bbn.com>
- Date: 1 Jun 90 16:15:32 GMT
-
- Oops...
-
- From: Kevin Braunsdorf <ksb@nostromo.cc.purdue.edu>
- To: rsalz@BBN.COM
-
- In article <2596@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@uunet.uu.net.
- Use a domain-based address or give alternate paths, or you may lose out.
-