Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QString to char* without converting



  • Hey. How to convert a QString to char *, in other words how to get to the data without conversion data? Get the data as they are.



  • Hi,
    as long as the internal structure does not change you can use the function utf16() for that. This is what you can call the win32 API *W functions with directly.
    If you want to stay within Qt you can use the data() function that returns a QChar* pointer which essentially is also a wrapper for an UTF16 character.
    -Michael.


Log in to reply