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. Can you pass a QTextStream as a function parameter?

Can you pass a QTextStream as a function parameter?

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

    Hello,

    I am trying to pass a QTextStream that contains IntelHex data to a function so I can process the stream into the proper order, can QTextStream simply be passed as a function parameter or am I going to have to write it to a file and then pass the file location?

    M 1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Why not just try it?
      You can pass it as Pointer or Reference as you like.

      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
      5
      • A amanill

        Hello,

        I am trying to pass a QTextStream that contains IntelHex data to a function so I can process the stream into the proper order, can QTextStream simply be passed as a function parameter or am I going to have to write it to a file and then pass the file location?

        M Offline
        M Offline
        mpergand
        wrote on last edited by
        #3

        @amanill said in Can you pass a QTextStream as a function parameter?:

        I am trying to pass a QTextStream that contains IntelHex data

        I'm very suspicious about that, QTextStream deals with characters and hex numbers should be in the 0xxxx form.
        If you need to convert little endian to host, this is the wrong way to go.
        Look at QDataStream and the setByteOrder() method instead.

        aha_1980A 1 Reply Last reply
        0
        • M mpergand

          @amanill said in Can you pass a QTextStream as a function parameter?:

          I am trying to pass a QTextStream that contains IntelHex data

          I'm very suspicious about that, QTextStream deals with characters and hex numbers should be in the 0xxxx form.
          If you need to convert little endian to host, this is the wrong way to go.
          Look at QDataStream and the setByteOrder() method instead.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @mpergand if the op means https://en.wikipedia.org/wiki/Intel_HEX then QTextStream is indeed correct.

          otherwise you are right.

          Qt has to stay free or it will die.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            amanill
            wrote on last edited by
            #5

            as @aha_1980 linked I am referring to IntelHex, essentially I have 2 IntelHex files that I need to merge, process and encrypt.

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Then you should read them via QFile into a QByteArray, do your processing and save the result back into a new QFile.

              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
              3

              • Login

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