Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Reading large files

Reading large files

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PabloAG
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      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:

      • http://qt-project.org/doc/qt-5/QFile.html
      • http://qt-project.org/doc/qt-5/QIODevice.html

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved