[Qt-interest] Writing QIODevice's data to a QByteArray

Rohan Prabhu rohan at rohanprabhu.com
Thu Dec 10 19:00:22 CET 2009


Let's say I have this QIODevice:

QIODevice* myDevice = getIODevice(); //just some function with which I get
an IODevice pointer

and in some function [slot]:
void onDeviceRead() {
    QByteArray* ba = getByteArray(); //some other function. NOTE: This
QByteArray may not neccessarily be empty
    //....
}

and:

QObject::connect(myDevice, SIGNAL(readyRead()), this, SLOT(onDeviceRead()));

Now, I want to append whatever data is there in the QIODevice [the size
given by: getIODevice->bytesAvailable()] to the byteArray. I just need to
know the methods to do it. I mean, the function onDeviceRead() has access to
the myDevice QIODevice object...

Any help is appreciated,
Thanks,
Rohan Prabhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091210/7a60d2af/attachment.html 


More information about the Qt-interest-old mailing list