How to convert LPTSTR to QString or QByteArray
-
try:
@LPTSTR myStr;
...
QString convertedStr = QString::fromLocal8Bit((const char *)myStr);@ -
if you use Unicode charset LPTSTR will be typedef of LPWSTR, in this case use
@QString QString::fromWCharArray ( const wchar_t * string, int size = -1 )@ -
As "AcerExtensa" I think you use unicode character set (in latest VC versions this is the default)
So you could try something like this:
@
#ifdef UNICODE
QString convertedStr = QString::fromWCharArray(yourLPTSTR)
#else
QString convertedStr = QString::fromLocal8Bit(yourLPTSTR)
#endif
@ -
[quote author="cincirin" date="1326884757"]As "AcerExtensa" I think you use unicode character set (in latest VC versions this is the default)
So you could try something like this:
@
#ifdef UNICODE
QString convertedStr = QString::fromWCharArray(yourLPTSTR)
#else
QString convertedStr = QString::fromLocal8Bit(yourLPTSTR)
#endif
@[/quote]and set second param - datasize for your string