Xref: utzoo comp.lang.c:29274 alt.sources:1939 Path: utzoo!mnetor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!think!mintaka!mit-eddie!bbn.com!papaya.bbn.com!rsalz 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 References: <6550.26639B0A@puddle.fidonet.org> <2596@litchi.bbn.com> Followup-To: comp.lang.c Organization: BBN Systems and Technology, Inc. Lines: 25 Oops... From: Kevin Braunsdorf 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.