Solved

Is there a function to convert Hex to Decimal

Posted on 1999-01-15
5
324 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
Comment Utility
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
Comment Utility
how are you outputing this value?
0
 
LVL 11

Expert Comment

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

Expert Comment

by:nietod
Comment Utility
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
Comment Utility
can u please suggest me a schematic method that converts hex to decimal
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

772 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

12 Experts available now in Live!

Get 1:1 Help Now