Is there a function to convert Hex to Decimal

Is there a function to convert Hex to Decimal in C/C++.
I'm using the GetForegroundWindow function to get the handle of the current window. I need this value in decimal  but am being returned a Hex value.
PaulBlackAsked:
Who is Participating?
 
MCoroliConnect With a Mentor Commented:
Both Hex and Decimal are of int type; GetForegraundWindow returns HWND which is int. So you can use returned value as int (Hex or Decimal - no matter)
For sure you can write something like
int handle=(int)GetForegroundWindow ();
There is no function to convert hex to decimal; you can output integer value in both formats.
Regards
0
 
nietodCommented:
how are you outputing this value?
0
 
alexoCommented:
>> There is no function to convert hex to decimal
Of course there is.  sscanf("%x", ...)
0
 
nietodCommented:
MCoroli's point is that the value is not stored in either hex or decimal, it is stored in binary (not that that matters).  What matters is what procedure is being used to display or output the value.  That procedure is convertig it to hex and probably can convert it to decimal.
0
 
frozentears1405Commented:
can u please suggest me a schematic method that converts hex to decimal
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.