[Interest] Converting QStrings to const char *

ich alex at golks.de
Tue Jul 21 19:09:18 CEST 2020


Pay attention:

::toUtf8() returns a QBytearray. After your complete call, the constData() is invalid.
You must copy the pointer before the QBytearray gets out of scope.


Am July 21, 2020 4:58:54 PM UTC schrieb Doogster <thedoogster at gmail.com>:
>My program uses both Qt and a C API that takes, as parameters, UTF-8
>const char * strings.
>
>Is this the correct way to convert a QString containing a UTF8 string
>to that format?
>
>qString.toUtf8().constData()
>_______________________________________________
>Interest mailing list
>Interest at qt-project.org
>https://lists.qt-project.org/listinfo/interest

-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200721/8e5be25f/attachment.html>


More information about the Interest mailing list