On Thursday, 27 December 2012 09:40:12 CEST, 程梁 wrote:
> But could you tell me why this happen? Why I have to assign QByteArray to 
> another variable?

From the QByteArray::constData's documentation: "The pointer remains valid as 
long as the byte array isn't reallocated or destroyed.". If you don't store the 
QByteArray into a variable, the temporary is destroyed immediately.

> And why only the content is wrong?

Because you were lucky. It is not allowed to access memory in such a way in C++.

Cheers,
Jan

-- 
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to