You may be worried about code and data portability: if you exchange binary files between different machines, binary data will be considered garbage (for example, due to differences in size and word differences). If you are only reading binary data on the same computer that wrote it, this is normal.
Another problem, especially when the data is huge and / or expensive, is reliability in relation to the evolution of your code base. For example, if you are reading a binary structure, and if you had to change the type of one of your fields from int (or int32_t ) to long (or int64_t ), then your binary data file is useless (unless you code specific conversion procedures). If the binary was expensive to produce (for example, an experimental device or expensive computation is required to create one), you may have problems.
This is why structured text formats (which are not a silver bullet but useful) or database management systems are used. Structured text formats include XML (which is rather complicated), Json (which is very simple) and Yaml (the complexity and power between XML and Json). And text formats are easier to debug (you can look at them in the editor). There are several free libraries for working with these data formats. Databases are often more or less relational and Sql . There are several free DBMS programs (for example, PostGresQL or MySQL ).
It refers to portability of binary files (between different machines), which may interest you in serialization methods, formats ( XDR , Asn1 ) and libraries (for example, S11n and others).
If space or bandwidth is a concern, you can also consider compressing your text data.
source share