Solved

Is there a function to convert Hex to Decimal

Posted on 1999-01-15
5
329 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

734 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