[Interest] Transfering ownership of QByteArray to char*

Thiago Macieira thiago.macieira at intel.com
Mon Aug 20 10:14:07 CEST 2012


On segunda-feira, 20 de agosto de 2012 12.01.59, Konstantin Tokarev wrote:
> Hi all,
> 
> Is there a safe way to get char * from QByteArray which is not destroyed
> when original QByteArray is destroyed?
> 
> I'm thinking about something like
> 
> QByteArray ba = ...;
> char *data = ba.data();
> ba.data() = '\0';

That is safe.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120820/80f2671e/attachment.sig>


More information about the Interest mailing list