[Interest] QFile::write(const QByteArray&) does not write all data?

alexander golks alex at golks.de
Wed May 9 11:09:23 CEST 2018


hi,

i recently stumbled over this situation, running on windows 7 using qt-5.6.3.
when trying to write ~50MB of data, write does not always complete, the file does not contain all data,
yet no error is returned.

i always thought, QFile::write(const QByteArray&) is meant to write all data.
as stated in the documentation for: qint64 QIODevice::writeData(const char *data, qint64 maxSize)
"When reimplementing this function it is important that this function writes all the data available before returning."

is this a bug in QFile?
or do i have to do-while loop to write the rest of my data?
but wouldn't this lead missing writes in QDataStream + QFile, as QDataStream needs complete writes, too?

alex

-- 
/*
 *  Learn to pause -- or nothing worthwhile can catch up to you.
 */



More information about the Interest mailing list