How to convert string to TCHAR* in VC++ ?
Thanks.
How to convert string to TCHAR* in VC++ ?
Thanks.
I resolved it using (TCHAR*)str.c_str()
If your project is Unicode, you need MultiByteToWideChar
. Otherwise, just use str.c_str();
#include <atlstr.h>
String dir="hello world";
char * data = new char[dir.size() + 1];
copy(dir.begin(), dir.end(), data);
data[dir.size()] = '\0';
USES_CONVERSION;
TCHAR* directory = A2T(data);