Existe-t-il une chaîne équivalente à LPTSTR?
Question
Existe-t-il une chaîne équivalente à LPTSTR? Je connais les ficelles et les ficelles. Y a-t-il un tstring?
La solution
Vous pouvez en définir un:
typedef std::basic_string<TCHAR> mystring;
...
mystring test = _T("Hello World!");
Autres conseils
Une autre option (ne nécessite pas 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
Utilisation:
ustring_t mystr = TEXT("hello world");
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow