char block[4096];
qint64 totalRead = 0;
while(!atEnd())
{
qint64 in = read(block, sizeof(block));
if (in <= 0)
break;
totalRead += in;
if(in != out.write(block, in));
}