string to hex

A

archilleswaterland

hi,
I want to prompt user to enter a hex value and read it as a hex -
this entry will be treated as a memory address
I don't want to bother the user to enter 0x - do I read it as a string
? if yes, how do i convert it to hex ?
thanks,
archilles
 
M

Michael Mair

hi,
I want to prompt user to enter a hex value and read it as a hex -
this entry will be treated as a memory address
I don't want to bother the user to enter 0x - do I read it as a string
? if yes, how do i convert it to hex ?

You are looking for strtol(), strtoul() called with base 16.


Cheers
Michael
 
E

Emmanuel Delahaye

I want to prompt user to enter a hex value and read it as a hex -
this entry will be treated as a memory address
I don't want to bother the user to enter 0x - do I read it as a string

fgets() + strtoul() (base 16)
? if yes, how do i convert it to hex ?

Bad question. You meant "How do I convert the hex string into a
numerical value ?"

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

..sig under repair
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,161
Messages
2,570,892
Members
47,427
Latest member
HildredDic

Latest Threads

Top