How would I convert a System (.net) C++\CLI String^ into a MFC C++ LPCTSTR string.
It is very easy to get a LPCTSTR into String^, but so far found nothing on doing it the other way around.
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.
If you have Visual Studio 2008 or above, you should be able to do this using the C++/CLI marshaling library, like so:
More information on marshaling between types on MSDN: Overview of Marshaling in C++