Question

Is there an string equivalent to LPTSTR? I know of string and wstring. Is there a tstring?

Was it helpful?

Solution

You could define one:

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

OTHER TIPS

Another option (doesn't 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

Usage:

ustring_t mystr = TEXT("hello world");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top