Subject: Re: Question regarding the array of size 0.
To: John Franklin <franklin@elfie.org>
From: Lord Isildur <mrfusion@umbar.vaxpower.org>
List: tech-kern
Date: 03/30/2001 10:37:28
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
> franklin@elfie.org
> ICBM: N37 12'54", W80 27'14" Z+2100'
>