[SOLVED] Size of serialized data.



  • Hi guys!

    Now I am writing a code for saving data into the file. Usually data files have header at the beginning where table with offsets is located. For example I want to save 10 objects into my file, each object have quite large size. Size of each objects could be different. So, to read one object I need to know its offset into the file (If I don't want to read every object before). Of course I can do that manually, just by calculating size of each serialized object, but at this point it seems that I will have to do a lot of tedious work with sizeof(), because each object has a lot of related dynamic data. My question is what is the best way to generate this table while writing file, may be there are some sort of patterns which are used in this case, or special classes/functions in Qt?


  • Moderators

    Hi @Harb,

    My question is what is the best way to generate this table while writing file

    That really depends on how your data is structured, and how you want to use it.

    Could you provide more details?

    may be there are some sort of patterns which are used in this case, or special classes/functions in Qt?

    There are many ways to save data to disk. Here are 3 options:



  • @JKSH Tnx!
    I think I managed to overcome this problem, so there is no need in further discussion of details : )/
    tnx for links!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.