Boost logo

Boost Users :

From: Graham Reitz (graham.cpp_at_[hidden])
Date: 2008-05-29 14:19:07


I didn't see anything, but I may have missed something.

Problem:

Binary data is stored in a char buffer from a proprietary device:

char* buffer = new char[6];

Data in buffer:

[byte 1][byte 2][byte 3][byte 4][byte 5][byte 6]
[---16 bit uint--][------------32 bit uint-------------]

...would like to convert to this in a C++'ish style using a boost
facility if it exists: (or consider directing me somewhere else if it
doesn't)

struct // or class
{
    boost::uint16_t first;
    boost::uint32_t second;
} data;

I would like to avoid a C-style way of doing this.

This seems like something that would have been solved many times.

thanks,
graham


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net