Reading large files
-
Hi,
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?
Thanks
-
Hi,
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.
Documentation: