sine one knows the size of the struct, who need the pointer? just 
take the displacement. 

char* buf; /* some buffer */
struct foo{
int header;
struct funkystruct blah;
};

(struct foo*)buf; /*your headers are here */
(struct foo*)buf+1; /* and your data is here */


Isildur

On Fri, 30 Mar 2001, John Franklin wrote:
> 
> You can then read in a block of memory from a file or socket, cast the
> buffer to that data type and have the header and data all accessable 
> via the same structure while leaving the sizeof(struct foo) equal
> to the header's size.
> 
> jf
> -- 
> John Franklin
> [EMAIL PROTECTED]
> ICBM: N37 12'54", W80 27'14" Z+2100'
> 

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to