QByteArray resize/sizeof problem.
General and Desktop
4
Posts
3
Posters
2.0k
Views
1
Watching
-
QByteArray adds \0 to your data. Sizeof might miss that. Or it reports something completely different. Use QByteArray::size() instead.
-
The sizeof() a QByteArray object has nothing to do with the amount of data the object manages. It is the size of the object member variables used to track the array content. QByteArray operates a private implementation object and likely only contains a 4 byte pointer to that private object; hence the reported size.
sierdzio has the function that reports the amount of data in the QByteArray.