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 262 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 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?

    jsulmJ 1 Reply Last reply
    0
    • I Infinity

      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?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 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

      • Login

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