質問

LPTSTRに相当する文字列はありますか? stringと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