• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1478
  • Last Modified:

MFC HexString to ASCII

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
psft
Asked:
psft
1 Solution
 
jkrCommented:
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
 
psftAuthor Commented:
Hey thanks!  
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now