Problems Accesing a List of QByteArray
-
Hi everyone! Im having kind of a basic problem.
I have a list of QByteArray. I want to populate this list, byte by byte.This is an example of how I create my list
QList<QByteArray> List; QByteArray Array1,Array2,Array3; List.append(Array1); List.append(Array2); List.append(Array3);
How i Usually populate a single QByteArray
QByteArray Test; unsigned char a=0x55; Test.append(a);
So far so good. Now i want to append a byte to a QByteArray thats contained in my list.
QList<QByteArray> List; QByteArray Array1,Array2,Array3; List.append(Array1); List.append(Array2); List.append(Array3); unsigned char a=0x55; List.at(1).append(a);
What im trying to do, is to my Array2 (The one that is placed on position 1 of List) append the byte a (that contains 0x55)
The following error code appears:
passing 'const QByteArray'as 'this' argument of 'QByteArray& QByteArray::append(char)' discards qualifiers [-fpermissive]
If i change it to this (which i consider kind of the same)
((QByteArray)List.at(1)).append(a);
The program compiles, but it doesnt work, no result after that line.
If i place the mouse over the List.at(1) part, the sign QByteArray Appears. so calling List.at(1) returns a QByteArray..., Then why cant i append a byte to that QByteArray?
Thanks in advance!