Solved

hex to int

Posted on 2000-03-09
1
764 Views
Last Modified: 2013-11-20
Hi, community!

When I have got a WORD variable that contains a hex-value and I need this value as int to calculate with it, how do I convert it?
And how do I convert any numeric type variable into CString in order to control the value in a MessageBox?
0
Comment
Question by:BoogieBoy
[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
1 Comment
 
LVL 31

Accepted Solution

by:
Zoppo earned 5 total points
ID: 2600198
Hi BoogieBoy,

numeric variables do not differ between a hex or a decimal or something. Hex is just how an app shows a value. I.e.

ASSERT( 0x0f == 15 ); // will always be true

to convert a numeric value to a CString you can use CString::Format(), i.e.

....
int x = 123456789;
double f = 12345.6789;
CString t;
t.Format( "x = %d (hex:0x%08X), f = %f (%e).", x, x, f, f );

sets t to:
"x = 123456789 (hex:0x075BCD15), f = 12345.678900 (1.234568e+004)"

hope that helps,

ZOPPO
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

615 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