¿Hay una cadena equivalente a LPTSTR?
Pregunta
¿Hay una cadena equivalente a LPTSTR? Sé de cuerdas y wstring. ¿Hay una tstring?
Solución
Podría definir uno:
typedef std::basic_string<TCHAR> mystring;
...
mystring test = _T("Hello World!");
Otros consejos
Otra opción (no requiere 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
Uso:
ustring_t mystr = TEXT("hello world");
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow