Conversion between TCHAR to std::string

Incase you have some variables declared as below, and you would need to store a TCHAR into a string, you can use the below method:
std::string objExeDir
TCHAR szModulePath[_MAX_PATH];
char    *pMBBuffer = (char *)malloc( 100 );
wcstombs(pMBBuffer, szModulePath, 200 );
objExeDir = pMBBuffer;

Leave a Reply

Your email address will not be published. Required fields are marked *