Solved

Is there a function to convert Hex to Decimal

Posted on 1999-01-15
5
325 Views
Last Modified: 2010-04-02
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.
0
Comment
Question by:PaulBlack
5 Comments
 
LVL 1

Accepted Solution

by:
MCoroli earned 50 total points
ID: 1182300
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
 
LVL 22

Expert Comment

by:nietod
ID: 1182301
how are you outputing this value?
0
 
LVL 11

Expert Comment

by:alexo
ID: 1182302
>> There is no function to convert hex to decimal
Of course there is.  sscanf("%x", ...)
0
 
LVL 22

Expert Comment

by:nietod
ID: 1182303
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
 

Expert Comment

by:frozentears1405
ID: 9894491
can u please suggest me a schematic method that converts hex to decimal
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now