I have a class which returns a typed pointer to a “const TCHAR”. I need to convert it to a std::string but I have not found a way to make this happen.
Can anyone provide some insight on how to convert it?
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.
Depending on your compiling settings,
TCHARis either acharor aWCHAR(orwchar_t).If you are using the multi byte character string setting, then your
TCHARis the same as a char. So you can just set your string to theTCHAR*returned.If you are using the unicode character string setting, then your
TCHARis a wide char and needs to be converted using WideCharToMultiByte.If you are using Visual Studio, which I assume you are, you can change this setting in the project properties under Character Set.