Is there a line equivalent to LPTSTR?

Is there a line equivalent to LPTSTR? I know the string and wstring. Is there a tstring?

+1
source share
2 answers

You can define one:

typedef std::basic_string<TCHAR> mystring; ... mystring test = _T("Hello World!"); 
+9
source

Another option (does not require windows.h ):

 #if defined(_UNICODE) || defined(UNICODE) typedef std::wstring ustring_t; typedef wchar_t uchar_t; #define TEXT(x) (L##x) #else typedef std::string ustring_t; typedef char uchar_t; #define TEXT(x) (x) #endif 

Using:

 ustring_t mystr = TEXT("hello world"); 
+4
source

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


All Articles