Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
4.8.0, 5.2.0
-
None
-
Linux, Qt 4.8, amd64
Description
Hello, in this kind of code:
do
{
QBitArray block=file.read(blockSize);
if(file.error()!=QFile::NoError)
//error
or
char charArray[blockSize];
qint64 readSize=file.read(charArray,blockSize);
if(readSize==-1)
//error
}
while(not the end);
All error is detected (media problem, network share disconnected). But not if the file is truncated by other external program during the copy.
Into the doc:
However, reading past the end of the stream is considered an error, so this function returns -1 in those cases
Bug with file on windows share and truncated by echo '' > file on the server. Bug too with truncated on same computer on linux environment.
This truncate need be do by external program (here echo '' > file), during the file read by the Qt program. I use big file (3.8GB to have time to do echo '' > file)