Why does QFile :: canReadLine () always return false?

I tried to read the file line by line using

while (file.canReadLine()) {
    QString line = QString::fromUtf8(file.readLine());
    qDebug() << line;
}

but it QFile::canReadLine()always returns false, although it file.readLine()succeeds and reads the next line every time it calls (I tested this).

Is it supposed to always return false? The docs say it always returns false for unbuffered devices , but doesn't support QFile?

I am using Qt 4.7.4.

+5
source share
1 answer

This does not seem to be the expected behavior . This is a mistake, and it has already been sent .

This affects Qt versions 4.7.4, 4.8.0, 4.8.1, 4.8.2.

+3
source

All Articles