You would have to provide more details, like the C compiler, flags, etc.

IIRC unless you specify otherwise, C aligns structure members on 4 or 8 byte
boundaries. You can force it to pack structs, which you want in your case.

On Sun, Sep 4, 2011 at 6:34 PM, Natty <[email protected]> wrote:

> Hi,
>
> I've packed a C structure which looks similar to:
>
> struct  {
>   unsigned char _vMapping1[3]; //  on the system perl is running, it sums
> up to 3 bytes.
>   unsigned char _vMapping2[3];   // on the system perl is running, it sums
> up to 3 bytes.
>   short _uPnP;  //  on the system perl is running, it sums up to 2 bytes.
> }
>
> I think there are some fill bytes, which there shouldn't be I believe,
> since I am not getting what I'm expecting when using:
>
> my $bin = unpack('c[3]c[3]s',...);
>
> is there a module which will make my life easier to pack / unpack C
> structures / binary data?
>
> thanks,
>
>
>
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
>
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to