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

Vadim Peretokin vperetokin at gmail.com
Wed May 9 11:24:58 CEST 2018


Obvious question but do you flush?

On Wed, May 9, 2018 at 11:09 AM alexander golks <alex at golks.de> wrote:

> 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.
>  */
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180509/2f7bbd9c/attachment.html>


More information about the Interest mailing list