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!