Solved

Is there a function to convert Hex to Decimal

Posted on 1999-01-15
5
331 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

623 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