[Interest] Transfering ownership of QByteArray to char*

lars.knoll at nokia.com lars.knoll at nokia.com
Mon Aug 20 10:16:07 CEST 2012


On Aug 20, 2012, at 10:01 AM, ext Konstantin Tokarev <annulen at yandex.ru> wrote:

> Hi all,
> 
> Is there a safe way to get char * from QByteArray which is not destroyed when original QByteArray is destroyed?

Only one: Create a copy ;-)

Cheers,
Lars

> 
> I'm thinking about something like
> 
> QByteArray ba = ...;
> char *data = ba.data();
> ba.data() = '\0';
> 
> 
> -- 
> Regards,
> Konstantin
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list