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