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

alexander golks alex at golks.de
Fri May 11 10:03:58 CEST 2018


Am Thu, 10 May 2018 23:32:14 -0700
schrieb Thiago Macieira <thiago.macieira at intel.com>:

> On Thursday, 10 May 2018 23:11:04 PDT alexander golks wrote:
> > i think it "silently" breaks here without setting error condition on the
> > QFile when hitting errors on all chunks but the first one, thus returning a
> > size lower the input array size, which is the behaviour i see.  
> 
> It's not an error to not write everything.
> 

well, msdn[1] tells me:
"If the function fails, or is completing asynchronously, the return value is zero (FALSE). To get extended error information, call the GetLastError function."
and more about async, etc.

but, whatever error there may be, i must resolve this, when i have it. but with current implementation it is silently captured.

and still, may question remaines valid:
> but wouldn't this lead missing writes in QDataStream + QFile, as QDataStream needs complete writes, too?

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365747(v=vs.85).aspx

-- 
        /*
         *  if(ct<0)
         *          ct=2;        /* Shit happens.. *\/
         *  linux-2.6.6/drivers/net/wan/z85230.c
         */



More information about the Interest mailing list