On Mon, 17 Jan 2000, Aditya Deshpande wrote:

> Hi Philip
> 
>     The problem could be caused becoz of the use of sizeof. If you
> see in the Linux source code also they do not rely on sizeof for reading
> data from files. What they do is use #define to define a SIZE macro
> defining the size of the struct and then read from file using that macro
> as size

Possible, but it doesn't take care of the fact that there are two empty
bytes within the structure.  Data gets read into them anyway because as
far as fread knows, it has a memory address (pointer to the struct) and a
number of bytes to read into it (sizeof / SIZE)  It doesn't really know
the structure of the struct or that the first two elements are bytes and
the next is a dword.  All it knows is destination starts at 0xbffffbb8 and
extends for 16 or 14 bytes depending on what I tell it.

Philip



To subscribe / unsubscribe goto the site www.ilug-bom.org ., click on the mailing list 
button and fill the appropriate information 
and submit. For any other queries contact the ML maintener

Reply via email to