هل هناك ما يعادل السلسلة لLPTSTR؟
سؤال
هل هناك ما يعادل السلسلة لLPTSTR؟ وأنا أعلم من سلسلة وwstring. هناك tstring؟
المحلول
هل يمكن تحديد واحد:
typedef std::basic_string<TCHAR> mystring;
...
mystring test = _T("Hello World!");
نصائح أخرى
وثمة خيار آخر (لا يتطلب 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
والاستعمال:
ustring_t mystr = TEXT("hello world");
لا تنتمي إلى StackOverflow