Skip navigation.
 
mlHow do I get around this?
FROM : John Draper
DATE : Sun Nov 28 07:56:26 2004

I have the following definitions....

#import <strings.h>


  u_char pkt[95];
  u_long a_long;



  bzero(&pkt, 95);
  a_long = 23L;
  bcopy(&a_long, &pkt[UID] 4);    <---- This fails to compile...

I get:  error - parse error before numeric constant?
What in tarnation does THIS mean...  how can I copy the contents of a
local
variable like "a_long" into a specific byte cell in the 'pkt' array of
"u_char"

I have to do an insane convoluted way of dealing with odd-sized packet
fields,  and when I define it as a struct,  the expected struct size
should be
95 bytes in length,  but instead it is 100 bytes in length.    WTF?

Ok,  so time for plan B...  I'm just going to use a character array of
8 bit bytes,  and MOVE the variables into the proper offset....  I know
it's a serious kludge,  but I got no other choice,

Of course I did the

#pragma option align=packed

Ran some tests,  and (sigh),  I just cannot start on an odd-byte
boundary for
a field....  is there any other way?

Also tried:

#pragma pack(1)

But (sigh) that don't work either....  is there ANY hope?

John

Related mailsAuthorDate
mlHow do I get around this? John Draper Nov 28, 07:56
mlRe: How do I get around this? Kevin Ballard Nov 28, 08:23
mlRe: How do I get around this? John Draper Nov 29, 03:41