Board index » cppbuilder » AnsiString to Hex

AnsiString to Hex


2005-06-21 01:10:55 AM
cppbuilder100
If I have a hex value as a string, eg "A3FE" is there a simple way to
convert it to it's decimal numeric value, (41982)?
Thanks,
Phil V
 
 

Re:AnsiString to Hex

"Phil V" < XXXX@XXXXX.COM >wrote:
Quote
If I have a hex value as a string, eg "A3FE" is there a simple way to
convert it to it's decimal numeric value, (41982)?
strtol()
Alan Bellingham
--
ACCU Conference 2006 - 19-22 April, Randolph Hotel, Oxford, UK
 

Re:AnsiString to Hex

"Phil V" < XXXX@XXXXX.COM >wrote in message
Quote
If I have a hex value as a string, eg "A3FE" is there a
simple way to convert it to it's decimal numeric value,
(41982)?
AnsiString hex = "A3FE";
int i = StrToInt("0x" + hex);
Gambit
 

{smallsort}

Re:AnsiString to Hex

Many thanks!
Great when you know how!
Phil V
"Alan Bellingham" < XXXX@XXXXX.COM >wrote in message
Quote
"Phil V" < XXXX@XXXXX.COM >wrote:

>If I have a hex value as a string, eg "A3FE" is there a simple way to
>convert it to it's decimal numeric value, (41982)?

strtol()

Alan Bellingham
--
ACCU Conference 2006 - 19-22 April, Randolph Hotel, Oxford, UK
 

Re:AnsiString to Hex

Phil V < XXXX@XXXXX.COM >wrote:
Quote
If I have a hex value as a string, eg "A3FE" is there a simple way to
convert it to it's decimal numeric value, (41982)?
std::istringstream iss("A3FE");
int i;
iss>>std::hex>>i;
if( !iss ) error();
Quote
Thanks,

Phil V
Schobi
--
XXXX@XXXXX.COM is never read
I'm Schobi at suespammers dot org
"Coming back to where you started is not the same as never leaving"
Terry Pratchett