Obsolete Members for QByteArray

The following members of class QByteArray are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

Public Types

(obsolete)

Member Function Documentation

const char *QByteArray::operator const char *() const

const void *QByteArray::operator const void *() const

This documentation is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns a pointer to the data stored in the byte array. The pointer can be used to access the bytes that compose the array. The data is '\0'-terminated. The pointer remains valid as long as the array isn't reallocated or destroyed.

This operator is mostly useful to pass a byte array to a function that accepts a const char *.

You can disable this operator by defining QT_NO_CAST_FROM_BYTEARRAY when you compile your applications.

Note: A QByteArray can store any byte values including '\0's, but most functions that take char * arguments assume that the data ends at the first '\0' they encounter.

See also constData().

© 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.