Doing serialization using streams C++

前端 未结 2 1021
余生分开走
余生分开走 2020-12-22 06:59

I implemented some serialization / deserialization using C++ after some help on this forum. The file seems to be written correctly but when I read it, new lines are ignored

2条回答
  •  礼貌的吻别
    2020-12-22 07:13

    Today you almost never need to implement your own low-level serialization.

    Try JSON, BSON, Protocol Buffers, MessagePack or XML.

    There are quite a lot of libraries, that will do it better than "roll-your-own"...

    You intended to write a binary serialization, but you insert EOL ('\n') characters. That's not a good choice of dividing a binary stream into tokens.

提交回复
热议问题