abayyari
asked on
Convert Hex to decimal in C/C++?
Can anyone provide me with a function that would convert a hex value to decimal in C/C++?
The following function converts from decimal to Hex:
string outputashex(unsigned long l) {
char buffer[1024];
itoa(l, buffer, 16);
return buffer;
}
I need from hex to decimal.
Thanks a lot.
Ahmed
The following function converts from decimal to Hex:
string outputashex(unsigned long l) {
char buffer[1024];
itoa(l, buffer, 16);
return buffer;
}
I need from hex to decimal.
Thanks a lot.
Ahmed
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
char hex_to_char(unsigned int i)
{
char c = i % 256;
return c;
}
{
char c = i % 256;
return c;
}
unsigned long strtoul(const char *S, char **PTR,
int BASE);
unsigned long _strtoul_r(void *REENT, const char *S,
char **PTR, int BASE);
for more information see manual pageof strtoul