Serialise and deserialise vector in binary

前端 未结 4 1219
时光说笑
时光说笑 2020-12-11 21:42

I am having problems trying to serialise a vector (std::vector) into a binary format and then correctly deserialise it and be able to read the data. This is my first time us

4条回答
  •  隐瞒了意图╮
    2020-12-11 22:13

    Read the other's answer to see how you should read/write a binary structure.

    I add this one because I believe your motivations for using a binary format are mistaken. A binary format won't be easier that an ASCII one, usually it's the other way around.

    You have many options to save/read data for long term use (ORM, databases, structured formats, configuration files, etc). The flat binary file is usually the worst and the harder to maintain except for very simple structures.

提交回复
热议问题