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. How can i just read first 2 lines of the file but not entirely load it to RAM
Forum Updated to NodeBB v4.3 + New Features

How can i just read first 2 lines of the file but not entirely load it to RAM

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 610 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.
  • J Offline
    J Offline
    jzq740176597
    wrote on last edited by
    #1

    like noted above,If the file is GB level,i want just 2 first lines data(in bytes).
    of course, the line is variable so need to find the 2 \n position.

    Despite the performance,the RAM is totally not doable for load the whole file.will crash.

    any advice?

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

      Hi,

      You want QFile::readLine(). See http://qt-project.org/doc/qt-5/qfile.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