سؤال

هل هناك ما يعادل السلسلة ل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");
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top