Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Can anybody help me in converting the string to hex value in OBJECTIVE C?

I have to pass the hex value to a macro.
I have it in string like ---- 0xfffff
How can I convert this string to hex and in what data type?
Posted
Updated 14-Dec-10 19:21pm
v2

1 solution

Try sprintf for that:

http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/[^]

From hex to int:
Convert a "Hex String" to an Integer[^]

By the way: A hexadecimal value is always a kind of representation just like the decimal representation is. The computer internally always uses a binary format because it is, of course, a binary machine.
Also, the data type can be what you see in it:
Example:
Character 'A' is represented '65' as decimal, '0x41' as hexadecimal and '1000001b'. So, depending on how you interpret it (text or represent it in some numeric base) it gets another meaning.

Good luck!
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900