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.
Who is Participating?
jkrConnect With a Mentor Commented:
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

psftAuthor Commented:
Hey thanks!  
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.