sandor
8th May 2011, 14:22
Very simple:
1) pBuffer is char array (65535) long
2) file on disk is 8589 bytes
3) read returns -1 so qFatal in the tiny example gets executed - but why? If another value is put there, 20000 for example works (Size == 8589), 50000 returns -1 :(
QFile File("myfile");
if (File.open(QIODevice::ReadOnly)) {
qDebug() << "Fail";
return false;
}
qint64 Size = read(pBuffer, 65535); // The maximum number (looks like a hard number) what works is 38002
if (Size == -1) {
qFatal("Why?");
}
1) pBuffer is char array (65535) long
2) file on disk is 8589 bytes
3) read returns -1 so qFatal in the tiny example gets executed - but why? If another value is put there, 20000 for example works (Size == 8589), 50000 returns -1 :(
QFile File("myfile");
if (File.open(QIODevice::ReadOnly)) {
qDebug() << "Fail";
return false;
}
qint64 Size = read(pBuffer, 65535); // The maximum number (looks like a hard number) what works is 38002
if (Size == -1) {
qFatal("Why?");
}