Home > Mobile >  Would turn * QString anomaly, come in and have a look
Would turn * QString anomaly, come in and have a look

Time:09-27

Such as, the transformation code is as follows:
Would be * msg2=TEXT (" sequence operation error ");
QString qMsg=QString: : fromWCharArray (msg2);
UI. TeInfo - & gt; Append (qMsg);

In the second row, an error: __fastfail (FAST_FAIL_STACK_COOKIE_CHECK_FAILURE);

CodePudding user response:

No one ever encountered such a problem?

CodePudding user response:

String with \ 0 at the end, or manually in fromWCharArray specified length, or who knows you string when to end

CodePudding user response:

The TEXT macro is wrong, you use Microsoft's definition:
Syntax
C + +

Copy
Void TEXT (
Quote
);
The Parameters
Quote

Pointer to the string to interpret as UTF - 16 or ANSI.

The Return Value
None

So this macro returns a null pointer,

CodePudding user response:

reference donwmufromdying reply: 3/f
the TEXT macro is wrong, you use Microsoft's definition:
Syntax
C + +

Copy
Void TEXT (
Quote
);
The Parameters
Quote

Pointer to the string to interpret as UTF - 16 or ANSI.

The Return Value
None

So this macro returns a null pointer,


Debugging, can sometimes, sometimes wrong,
What's a good solution

CodePudding user response:

Take a look at this https://blog.csdn.net/u012260238/article/details/53759306

CodePudding user response:

QString QStringUtil: : wchar_tToQString (would be * wchar)
{
QString qMsg=QString: : fromWCharArray (wchar);

Return qMsg;
}

Would be * QStringUtil: : QStringToWchar_t (QString STR)
{
Would be szBuf [1024].
Wcscpy_s (reinterpret_cast & lt; Would be * & gt; (szBuf),
Sizeof (szBuf)/sizeof (would be),
Reinterpret_cast & lt; Const would * & gt; (STR. Utf16 ()));

Return szBuf;
}

His Mark,,,
  •  Tags:  
  • Qt
  • Related