🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4974

Re: converting a hex string to an int with atoi ?

#4974
From: Thomas Maeder [TeamB]
Date: Tue, 18 Oct 2005 17:45
14 lines
1596 bytes
"Peter" <Will_Bounce_So_Use_My_First_Name@Smart-Projects.net> writes:

> using :
>
> int atoi(const char *s);
> int _wtoi(const wchar_t *s);
>
> Can this function "understand" hex input and convert it properly ?

No. It can also not report conversion failure, which makes it totally
unusable.

Have a look at strtol() and strtoul(), which allow the base to be
passed as argument and who do report conversion failure.
Technical Details
Message-ID: <m24q7en2gn.fsf@madbox2.local>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!irazu.switch.ch!switch.ch!newsfeed.inode.at!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <435515ce@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5978392de90893ce
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: converting a hex string to an int with atoi ?
References: <435515ce@newsgroups.borland.com>
From: maeder@glue.ch (Thomas Maeder [TeamB])
Organization: TeamB
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
Date: Tue, 18 Oct 2005 19:45:44 +0200
Message-ID: <m24q7en2gn.fsf@madbox2.local>
User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)
Cancel-Lock: sha1:iKFAGM8xK9oRSPbt50neqXFmDMY=
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
NNTP-Posting-Host: 84.73.152.93
X-Trace: newsgroups.borland.com 1129657416 84.73.152.93 (18 Oct 2005 10:43:36 -0700)
Lines: 14
X-Authenticated-User: tmaeder
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!irazu.switch.ch!switch.ch!newsfeed.inode.at!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail