I've been trying for months to find a small C or C++ library for platform-independent binary file I/O, that means endian swapping and with fixed size types.
I know that huge libraries like wxWidgets and Qt have them, and that languages like Java and C# also have them, but I'd prefer to use a small library instead of a huge framework.
Usually, there is '/lib' folder on Windows or '/usr/lib' folder on Linux that contains all the libraries. Once the library is installed, the compiler and the linker know the path of the library to use, and the library is ready for use.
A binary file is a file whose content is in a binary format consisting of a series of sequential bytes, each of which is eight bits in length. The content must be interpreted by a program or a hardware processor that understands in advance exactly how that content is formatted and how to read the data.
Libraries can be binary code. In fact, most of the stuff in /lib is going to be libraries compiled to machine code. While things like cat are used in shell script like calls to code in libraries, they are not libraries in the FHS sense because they can be run by themselves.
How about Google Protocol Buffers?
The library includes bindings for C++, Java and Python.
Have a look at Boost.Serialization
One of it's goals is "Data Portability - Streams of bytes created on one platform should be readable on any other."
There are also links to other libraries providing similar functionality.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With