Domanda

Esiste una stringa equivalente a LPTSTR? Conosco corde e corde. C'è una stringa?

È stato utile?

Soluzione

Potresti definirne uno:

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

Altri suggerimenti

Un'altra opzione (non richiede 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

Utilizzo:

ustring_t mystr = TEXT("hello world");
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top