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 to get length of QByteArray with binary data?
Forum Updated to NodeBB v4.3 + New Features

How to get length of QByteArray with binary data?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 224 Views 2 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.
  • I Offline
    I Offline
    Infinity
    wrote on 5 Feb 2020, 11:58 last edited by
    #1

    I have to following code:

    QByteArray value = "2ad6a8da948de3ae0b73f5660574cc459fe8ad35";
    m_value = QByteArray(QByteArray::fromHex(value));
    m_length = m_value.
    

    If value contains a '\0' it will show the wrong value.

    What is the clean way to get the length of the binary data in QByteArray?

    J 1 Reply Last reply 5 Feb 2020, 12:05
    0
    • I Infinity
      5 Feb 2020, 11:58

      I have to following code:

      QByteArray value = "2ad6a8da948de3ae0b73f5660574cc459fe8ad35";
      m_value = QByteArray(QByteArray::fromHex(value));
      m_length = m_value.
      

      If value contains a '\0' it will show the wrong value.

      What is the clean way to get the length of the binary data in QByteArray?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 5 Feb 2020, 12:05 last edited by
      #2

      @Infinity https://doc.qt.io/qt-5/qbytearray.html#length

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

      1 Reply Last reply
      6

      1/2

      5 Feb 2020, 11:58

      • Login

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