packing a C structure



hi ,,,

iam trying to pack a C structure to send via socket..i would like to
know how to frame the template for the C structure..

this is my structure

typedef struct buffer_t {
uint32_t a;
char b[16];
uint32_t c;
uint32_t d;
char e[6];
char f[8];
} buffer_t;

kindly suggest me the format for the pack function call..this will
help me to solve my issue...

.



Relevant Pages

  • Re: packing a C structure
    ... iam trying to pack a C structure to send via socket..i would like to ... char b; ... Sheesh, I sure hope Scott Nudds doesn't read this;-) It's "more" portable because you have removed alignment and endianness problems, there's still a portability issue in that the receiving machine might speak EBCDIC while the sending machine speaks ASCII. ...
    (comp.lang.perl.misc)
  • Re: packing a C structure
    ... iam trying to pack a C structure to send via socket..i would like to ... know how to frame the template for the C structure.. ... char b; ...
    (comp.lang.perl.misc)
  • Re: packing a C structure
    ... char b; ... can u provide a guideline for the format in the Pack command that i ... memory, only how the language access it. ... vs little endian memory layout. ...
    (perl.beginners)
  • Re: packing a C structure
    ... char b; ... I have the impression that what you want is to pack values in Perl ... into a binary string of data that matches how a C program would do it. ... maximum of 15 characters), you probably want to replace "c16" in the ...
    (comp.lang.perl.misc)
  • Re: how to pack bitfields and make it cross container boundry
    ... Just a guess-- have you tried a char pack: ... given the luxury of using 16 bits anyway, the compiler decides to put b onto ... i build a bitfield structure and pack it as following ...
    (microsoft.public.vc.language)