How do I convert from CString to const char* in my Unicode MFC application?
How do I convert from CString to const char* in my Unicode MFC application?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To convert a
TCHARCString to ASCII, use theCT2Amacro – this will also allow you to convert the string to UTF8 (or any other Windows code page):There is also a macro to convert from ASCII -> Unicode (
CA2T) and you can use these in ATL/WTL apps as long as you have VS2003 or greater.See the MSDN for more info.