
On 3/28/06, Caleb Epstein <caleb.epstein@gmail.com> wrote:
On 3/28/06, Olaf van der Spek <olafvdspek@gmail.com> wrote:
When reading/writing binary streams, you often need to read/write an
(unaligned) integer in big, little or native endian. Is there support for this in Boost?
The closest thing I'm aware of is the portable_binary_oarchive (and iarchive) in the Boost.Serialization examples directory. This has logic to save integers and longs in little-endian format regardless of the hardware architecture, saving a single byte length + binary data that represents the value. For example, 42 would be saved as \x01\x2a and 1024 would be saved as \x02\x00\x04
Is the code/function that writes the binary value (without the length) also available in the interface or only in the implementation?