Solved

MFC HexString to ASCII

Posted on 2008-06-12
2
1,356 Views
Last Modified: 2013-12-14
In Visual C++ 6.0, I need to convert a CString hex variable with a value such as "FF" to an ASCII char that represents that string as a hex value.
0
Comment
Question by:psft
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 21773981
No problem:
#include <stdlib.h>
CString str = "FF";
char* pEnd;
 
long l = strtol((LPCTSTR)str,&pEnd,16);
 
char c = (char) l; // now you have a char that is set to 0xFF

Open in new window

0
 
LVL 1

Author Closing Comment

by:psft
ID: 31466752
Hey thanks!  
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

730 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