Convert string to TCHAR * in VC ++?

How to convert string to TCHAR * in VC ++?

Thanks.

+4
source share
3 answers

I decided to use it (TCHAR *) str.c_str ()

+7
source

If your project is Unicode, you need MultiByteToWideChar . Otherwise, just use str.c_str();

+2
source
 #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); 
+1
source

Source: https://habr.com/ru/post/1342271/


All Articles