There is a QVector <data> obj . How best to implement binary file I / O?
class data{ int var1; QString var2; bool var3; bool var4; void someFunc(); }; There is a QVector <data> obj . How best to implement binary file I / O?
class data{ int var1; QString var2; bool var3; bool var4; void someFunc(); }; The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .
Overload the operators << and >> for the class, and write / read the vector in QFile via QDataStream standard way using the same operators.
Here article on Habré about serialization of objects in Qt.
Source: https://ru.stackoverflow.com/questions/582231/
All Articles