Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.5k views
in Technique[技术] by (71.8m points)

c - How to choose a file type for serializing data?

How does someone pick an appropriate file type for serializing data to disk?

On this Quora question Why do we serialize data? I've read that serialization is for translating data structures into a standard format, maybe for otherwise incompatible systems to exchange data.

I'm a little unsure of what exchange means here. It couldn't just mean data traveling between computers, but also, for example, from a computer's memory to persistent storage on its disk.

This stackoverflow question What does data serialization do? also has an answer that describes serialization as a process for encoding data in a universally defined format so that data structures can be reconstructed.

When we're serializing data, we are trying to get data from point A to point B and have it arrive at its final destination in the same way that it left its starting point.

Here's an example: Let's say we're writing a video game in C, and we'd like to save some data to the computer's disk to save for the next time the player wants to continue playing. What are some options for file types to serialize this data in, and what are the proper considerations to make between them?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...