Entry
in C++ language . How to convert number of decimal to hexadecimal number
Jul 1st, 2004 03:26
Viet Commando, tcneoh,
Of course, a number of hexadecimal must be stored in a string. Thus you
can think about the problem convert a number to a string!
For this, use the function itoa() or function ltoa()
char *itoa( int value, char *string, int radix );
char *ltoa( long value, char *string, int radix );
Parametre:
value : Number to be converted
string : String result
radix : Base of value; must be in the range 2 – 36
Therefore, you should use: itoa(245621, buffer, 16) to convert the
number 245621 to hexadecimal