I am trying to create an array of around 4 QDataStreams, one for each QByteArray I have.
The situation is as follows:
struct dataform{
//other members
QDataStream block;
}
dataform gd[4];
//initialize data for each item in gd[]
QDataStream out[4];
for (int i = 0; i < 4; ++i){
out[i] = QDataStream(&gd[i].block, QIODevice::WriteOnly);
}
The compiler returns
‘QDataStream& QDataStream::operator=(const QDataStream&)’ is private
I have also tried to initialize out with
out[i](&gd[i].block, QIODevice::WriteOnly);
to no avail; the compiler returns
error: no match for call to ‘(QDataStream) (QByteArray*, QIODevice::OpenModeFlag)’
Is there any way to do this or do I need to make the array an array of QDataStream pointers, allocate the QDataStreams dynamically, and deference the stream every(several hundred times throughout the program) time I write to it?