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. Splitting a bin file of 10560 bytes
Qt 6.11 is out! See what's new in the release blog

Splitting a bin file of 10560 bytes

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 6 Posters 2.8k 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 Anna_64

    @jsulm how to show the start and end position
    also i need 64 chunks 16416 bytes from my file

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #8

    @Anna_64 said in Splitting a bin file of 10560 bytes:

    how to show the start and end position

    this is simple math

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    JonBJ A 2 Replies Last reply
    1
    • jsulmJ jsulm

      @Anna_64 said in Splitting a bin file of 10560 bytes:

      how to show the start and end position

      this is simple math

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #9

      @jsulm
      I previously answered this question asked by @Anna_64 in other thread at https://forum.qt.io/topic/100441/issue-reading-from-qserialport/14.

      1 Reply Last reply
      0
      • jsulmJ jsulm

        @Anna_64 said in Splitting a bin file of 10560 bytes:

        how to show the start and end position

        this is simple math

        A Offline
        A Offline
        Anna_64
        wrote on last edited by
        #10

        @jsulm how to read a file in 64 times in qt

        jsulmJ 1 Reply Last reply
        0
        • A Anna_64

          @jsulm how to read a file in 64 times in qt

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #11

          @Anna_64 Using a for-loop and QFile::read(int) as @Christian-Ehrlicher suggested.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          3
          • jsulmJ jsulm

            @Anna_64 Read the file into a QByteArray and use https://doc.qt.io/qt-5/qbytearray.html#mid to split it

            A Offline
            A Offline
            Anna_64
            wrote on last edited by
            #12

            @jsulm i have a QByte Array z=y.mid(0,16326);
            i want to 64 chunk like this from 16326 how to do that

            J.HilkJ jsulmJ 2 Replies Last reply
            0
            • A Anna_64

              @jsulm i have a QByte Array z=y.mid(0,16326);
              i want to 64 chunk like this from 16326 how to do that

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #13

              @Anna_64
              you're either having us on, or you started coding literally last week.

              In the later case, you should to some tutorial/learning on the basics first.

              https://www.tutorialspoint.com/cplusplus/index.htm


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              4
              • A Anna_64

                @jsulm i have a QByte Array z=y.mid(0,16326);
                i want to 64 chunk like this from 16326 how to do that

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by jsulm
                #14

                @Anna_64 said in Splitting a bin file of 10560 bytes:

                i want to 64 chunk like this from 16326 how to do that

                So, you want to divide 16326 into 64 chunks, right?
                What would the size of one chink be then? This is now not programming, just simple math.
                If you calculated the size of one chunk, you then can have a for-loop (https://en.cppreference.com/w/cpp/language/for) which you execute 64 times and in each iteration read one chunk from the file (using QFile::read(int)).

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                A 1 Reply Last reply
                2
                • jsulmJ jsulm

                  @Anna_64 said in Splitting a bin file of 10560 bytes:

                  i want to 64 chunk like this from 16326 how to do that

                  So, you want to divide 16326 into 64 chunks, right?
                  What would the size of one chink be then? This is now not programming, just simple math.
                  If you calculated the size of one chunk, you then can have a for-loop (https://en.cppreference.com/w/cpp/language/for) which you execute 64 times and in each iteration read one chunk from the file (using QFile::read(int)).

                  A Offline
                  A Offline
                  Anna_64
                  wrote on last edited by
                  #15

                  yes i calculated size of a chunk it s 16416 now i take it like QByteArray y= iContents.mid(0,16416)
                  now i need 64 chunk like this
                  thank u for guiding

                  jsulmJ 1 Reply Last reply
                  0
                  • A Anna_64

                    yes i calculated size of a chunk it s 16416 now i take it like QByteArray y= iContents.mid(0,16416)
                    now i need 64 chunk like this
                    thank u for guiding

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #16

                    @Anna_64

                    for (int i = 0; i < 64; ++i) {
                        QByteArray y= iContents.mid(i * 16416, 16416);
                        ...
                    }
                    

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    A 1 Reply Last reply
                    3
                    • jsulmJ jsulm

                      @Anna_64

                      for (int i = 0; i < 64; ++i) {
                          QByteArray y= iContents.mid(i * 16416, 16416);
                          ...
                      }
                      
                      A Offline
                      A Offline
                      Anna_64
                      wrote on last edited by
                      #17

                      @jsulmthank you

                      Pablo J. RoginaP 1 Reply Last reply
                      0
                      • A Anna_64

                        @jsulmthank you

                        Pablo J. RoginaP Offline
                        Pablo J. RoginaP Offline
                        Pablo J. Rogina
                        wrote on last edited by
                        #18

                        @Anna_64 if your issue is solved please don't forget to mark your post as such!. Thanks.

                        Upvote the answer(s) that helped you solve the issue
                        Use "Topic Tools" button to mark your post as Solved
                        Add screenshots via postimage.org
                        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                        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