Thanks. I missed that seek() function completely. Implementing seek() to the QByteArray case seems to be working.
example:
array.append(buffer);
//out.pos() == 0
out << "hello"; //"hello" overwrites "funny"
out.seek(0); // set position to 0
// stream == "hello world"
// QTextStream reads into strings word by word delimited by space
out >> string; // == "hello"
out >> string2; // == "world"
QString buffer = "funny world";
QByteArray array;
array.append(buffer);
QTextStream out(&array,QIODevice::ReadWrite);
//out.pos() == 0
out << "hello"; //"hello" overwrites "funny"
out.seek(0); // set position to 0
QString string;
QString string2;
// stream == "hello world"
// QTextStream reads into strings word by word delimited by space
out >> string; // == "hello"
out >> string2; // == "world"
To copy to clipboard, switch view to plain text mode
Bookmarks