Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions
Reading large files
PabloAG last edited by
I'm trying to read a big file in my program. My application has a loop where it reads the file file through the QTextStream class. At the begining it works well but after 30 seconds it starts to go slower.
I've read that the QTextStream class is buffered and it's not aimed for reading large files but I haven't found more information. So, what's the most efficient way of reading large files in Qt?
Is it a text file or a binary file?
You could use QFile::read() to read a specific number of bytes/characters, or QFile::readLine() to read a whole line of text. These reads are not buffered.