[Interest] Converting QStrings to const char *

Thiago Macieira thiago.macieira at intel.com
Tue Jul 21 19:10:58 CEST 2020


On Tuesday, 21 July 2020 09:58:54 PDT Doogster wrote:
> 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()

^^^^

Just remember that it's a temporary. The pointer will be freed at the ;

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering





More information about the Interest mailing list