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 do I read specific lines from a txt file in Qt ?
Forum Updated to NodeBB v4.3 + New Features

How do I read specific lines from a txt file in Qt ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 500 Views 3 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
    Pappu Kumar Keshari
    wrote on last edited by
    #1

    How do I read specific lines from a txt file in Qt ?
    Suppose there are ten lines in text file and I have to read only fourth line.

    Christian EhrlicherC 1 Reply Last reply
    0
    • P Pappu Kumar Keshari

      How do I read specific lines from a txt file in Qt ?
      Suppose there are ten lines in text file and I have to read only fourth line.

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Pappu-Kumar-Keshari said in How do I read specific lines from a txt file in Qt ?:

      Suppose there are ten lines in text file and I have to read only fourth line.

      Use QFile::readLine() until you're at the 4th line.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote on last edited by Kent-Dorfman
        #3

        or

        head -4 file | tail -1

        no programming regquired

        ROLF

        I light my way forward with the fires of all the bridges I've burned behind me.

        jeremy_kJ 1 Reply Last reply
        0
        • Kent-DorfmanK Kent-Dorfman

          or

          head -4 file | tail -1

          no programming regquired

          ROLF

          jeremy_kJ Offline
          jeremy_kJ Offline
          jeremy_k
          wrote on last edited by
          #4

          @Kent-Dorfman said in How do I read specific lines from a txt file in Qt ?:

          or

          head -4 file | tail -1

          no programming regquired

          What is programming?

          Asking a question about code? http://eel.is/iso-c++/testcase/

          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