Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Question about binary data sotrage.

    C++ Gurus
    2
    7
    2960
    Loading More Posts
    • 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.
    • J
      jnewing last edited by

      So I just wanted to know what would be the most practical way, most efficient way to store a binary file between 1Meg to 10Meg (tops) for searching etc... would it be a QList, QVector or a simple old QDataArray? Is there a "norm" for this?

      Any feedback is much appreciated.

      1 Reply Last reply Reply Quote 0
      • A
        andre last edited by

        That would depend. Are you talking about storage on disk, or in memory? What do you need to search on? You really need to provide more details for good advice on this.

        1 Reply Last reply Reply Quote 0
        • J
          jnewing last edited by

          Sorry about that.

          Just to store this in memory (temporarily as it will be written out to a file in the end) as I need to search for specific occurrences of raw binary data.

          Breakdown;

          1 - read the binary file into someing (QByteArray, QList, QVector etc...)
          2 - search binary data thats now in memory
          3 - possible editing of binary data in memory
          4 - write out new binary data to flat file

          Hope this helps.

          1 Reply Last reply Reply Quote 0
          • A
            andre last edited by

            So, if I understand you correctly, you have one big blob of unstructured binary data, and you want to search if a specific binary sequence occurs anywhere in that blob. Right?

            Edit:
            you talk about reading it into containers. Does that mean that the data is structured after all? Do you need to search for a substring of any of these items, or do you only need to match on the whole item?

            1 Reply Last reply Reply Quote 0
            • J
              jnewing last edited by

              the data is not structured and i only need to match the whole item.

              1 Reply Last reply Reply Quote 0
              • A
                andre last edited by

                Sorry, I don't get it. It is not structured (into items), yet you only need to match on a whole item?

                If you do have basically a list of items, check out QMap if you need to keep the order of the items, and QSet otherwise. Otherwise, there is not much more choice than a linear searching of a QByteArray.

                1 Reply Last reply Reply Quote 0
                • J
                  jnewing last edited by

                  I will thanks :D

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post