Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. how to place float array inside a byte array?
Forum Updated to NodeBB v4.3 + New Features

how to place float array inside a byte array?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 2 Posters 469 Views
  • 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.
  • S Offline
    S Offline
    swansorter
    wrote on last edited by
    #1

    Is it possible to place float array inside byte array

    jsulmJ 1 Reply Last reply
    0
    • S swansorter

      Is it possible to place float array inside byte array

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

      @swansorter https://doc.qt.io/qt-5/qbytearray.html#number-4

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

      S 1 Reply Last reply
      1
      • jsulmJ jsulm

        @swansorter https://doc.qt.io/qt-5/qbytearray.html#number-4

        S Offline
        S Offline
        swansorter
        wrote on last edited by
        #3

        @jsulm i want to place float array inside byte array.
        example:-
        float floatArray1[5] = { 123.45f, 123.0f, 45.0f, 1.2f, 34.5f };
        float floatArray2[5] = { 123.45f, 123.0f, 45.0f, 1.2f, 34.5f };

        i want to place inside byte array

        jsulmJ 1 Reply Last reply
        0
        • S swansorter

          @jsulm i want to place float array inside byte array.
          example:-
          float floatArray1[5] = { 123.45f, 123.0f, 45.0f, 1.2f, 34.5f };
          float floatArray2[5] = { 123.45f, 123.0f, 45.0f, 1.2f, 34.5f };

          i want to place inside byte array

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

          @swansorter said in how to place float array inside a byte array?:

          i want to place inside byte array

          Then do so, what is the problem?
          I gave you the link to a method you can use to convert one float to QByteArray. Simply call it for each entry of your array and append the result to your QByteArray.

          Depending on your requirements you can also use https://doc.qt.io/qt-5/qdatastream.html

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

          1 Reply Last reply
          2

          • Login

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