Search code examples
c++serializationfile-format

Introductory material for creating file formats and doing serialization with C++


I am looking for a good short overview about things that are important when serializing data to files. What techniques exist to deal with later changes in data structures? Are there certain header structures that are commonly used?

Specifically for C++: What library is appropriate for such tasks? Boost.Serialization?

EDIT: If possible, please provide a link that contains some answers!

Thanks for any hints,

Philipp


Solution

  • The first part is the choice of format:

    • is it an internal/external file?
    • is it just used as temporary storage, or does it need to be edited/processed?
    • are there any speed or storage space concerns?

    Once you have the format, you need to think about things like versioning:

    • is backward-only compatibility OK, or do you need forward compatibility?
    • do you need this at all?

    And then you can think about libraries:

    • various XML libraries
    • Boost.Serialization
    • s11n