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. QDataStream for general purposes or standard c++ stream ?
QtWS25 Last Chance

QDataStream for general purposes or standard c++ stream ?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 3.8k 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.
  • T Offline
    T Offline
    tonnot
    wrote on last edited by
    #1

    I'm developing a system to manage information (data of any kind, but not objects).
    QDataStream offers platform independent, endianness , network.
    Is it worth to use Qdatastream only to manage data at memory level ? Maybe faster c++ stream ?
    I'd want to use Qdatastream, thinking at future uses of my data.

    What is your opinion.?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Can you rephrase that? What are you trying to do?

      (By the way, QDataStream does NOT offer network. It cannot handle short reads nor short writes.)

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tonnot
        wrote on last edited by
        #3

        Using QIODevice I could do anything with the data
        What I want to do is a general data system, ready to be used at memory level, file, etc. and the platform independent, endianness 'free'. This is thi first reason to try to use Qdatastream.

        By now, I'm using it to read-write floats, doubles, structures,etc.
        In adittion I'm using then qbytearray associated to retrieve data doing casting.

        Using a c++ stream for only this, are going to be faster ?

        1 Reply Last reply
        0
        • V Offline
          V Offline
          veeeee_d
          wrote on last edited by
          #4

          Any form of "pure" C++ is faster than using Qt. Qt is a framework, and frameworks are rarely ever faster than writing an specific implementation for what you need.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tonnot
            wrote on last edited by
            #5

            Thanks veeee_d. How many faster ? I know that it can be difficult to evaluate, imagine I want to use this schema to write 100 000 points (float, float, double). A similar system in pure c++ (with code to let platform independent and endianness free ) how many (in percent time) faster are going to be ? Thanks

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              That depends on your implementation.

              The question you asked is far too vague to give a proper answer.

              Of course you can do almost everything with QDataStream - the question is, whether this is reasonable in your actual context.

              If you use QDataStream to write your data, you will also need Qt for the application that reads the data.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tonnot
                wrote on last edited by
                #7

                A last question, using qdatastream, writing a float with 4, 8 for double, using litteendian, are going to means a file with 12 bytes. Knowing this information, the data coulde be recovered using another languaje ins't ?. Or could not ?
                Thanks

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  Yes, you can read the data again using another toolkit or language. The format of the data is documented. Reading in the data may not be as easy as it would be using Qt again, though.

                  1 Reply Last reply
                  0

                  • Login

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