On 02/27/2012 11:27 AM, Tobias Brandt wrote:
>> So, something like this should work:
>> [...]
>
> It really depends on how you wrote the file originally. If you
> know that it is packed, i.e. 10+32+32+32=106 bytes per record,
> then yes.

You meant 4 bytes per int. :)

> If you wrote to the file with a C++ program, then I guess the
> compiler aligned the data so that the whole struct is 128 bytes
> in size. Technically, the C++ compiler is allowed to do
> anything short of changing the order of the struct fields.

That is correct for non-POD types. The C++ compiler must treat POD structs essentially as if they are C structs.

Ali

Reply via email to