Pergunta

Existe uma cadeia equivalente a LPTSTR? Eu sei de corda e wstring. Existe uma tstring?

Foi útil?

Solução

Você pode definir um:

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

Outras dicas

Outra opção (não requer 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

Uso:

ustring_t mystr = TEXT("hello world");
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top