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. Read CSV and parse
Qt 6.11 is out! See what's new in the release blog

Read CSV and parse

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 14.8k 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.
  • R Offline
    R Offline
    Renato_Brasil
    wrote on last edited by
    #1

    Hi all.
    I am new with Qt.
    I need to create a code that will read a selected csv file in any folder and extract the information.
    The data in the csv file is numbers.
    The format is:
    Column, point, latitude (DDMMSS.ss hemisphere), longitude (DDMMSS.ss hemisphere), X (UTM), Y (UTM), data 1, data2).
    I used QString and Openfiledialog to indicate the file and read.
    How do I read the information line by line?

    the_T 1 Reply Last reply
    0
    • R Renato_Brasil

      Hi all.
      I am new with Qt.
      I need to create a code that will read a selected csv file in any folder and extract the information.
      The data in the csv file is numbers.
      The format is:
      Column, point, latitude (DDMMSS.ss hemisphere), longitude (DDMMSS.ss hemisphere), X (UTM), Y (UTM), data 1, data2).
      I used QString and Openfiledialog to indicate the file and read.
      How do I read the information line by line?

      the_T Offline
      the_T Offline
      the_
      wrote on last edited by the_
      #2

      @Renato_Brasil
      You may have a look at the QFile documentation. There is an example how to read a file line by line

      -- No support in PM --

      R 1 Reply Last reply
      4
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        This wiki article might also be of interest.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        R 1 Reply Last reply
        4
        • the_T the_

          @Renato_Brasil
          You may have a look at the QFile documentation. There is an example how to read a file line by line

          R Offline
          R Offline
          Renato_Brasil
          wrote on last edited by
          #4

          @the_ Thanks!

          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi and welcome to devnet,

            This wiki article might also be of interest.

            R Offline
            R Offline
            Renato_Brasil
            wrote on last edited by
            #5

            @SGaist Thanks!

            mrjjM 1 Reply Last reply
            0
            • R Renato_Brasil

              @SGaist Thanks!

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Renato_Brasil
              and for splitting, please see
              http://doc.qt.io/qt-5/qstring.html#split
              it will u give u a list of all the keys pr line

              ps. if huge file please read about the
              QVector<QStringRef> QString::splitRef

              its has better performance than the other but if small file and Desktop app, it wont matter much.

              1 Reply Last reply
              1

              • Login

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