>
> On Wed, 24 Apr 2002, Jay Francis wrote:
>
> > When I use 21 as the size for the new record I get an error message
> > Application (1.0) called SysFatal Alert with the message: "DataMgr.c,
> > Line 7025,DmWrite:DmWriteCheck failed"
> >
> > When I use 22 everything works perfectly.
> >
> > Am I not seeing something obvious?
> >
> > typedef struct {
> > UInt16 waterbody; //max value = 9999, 2 bytes
> > Char surveyDate[11]; // = 01/01/1994, 11
> > bytes includes null terminator
<SNIP>
> > } InfoRecordStruct; // 21 bytes
>
> The size of that string buffer is likely being rounded up to the nearest
> 2-byte boundary, so it actually takes up 12 bytes instead of 11.
>
>
Just to follow up with this since I've chased bugs like this a number of
times - I've now got into the habit of using "sizeof" when dealing with
structs.
1) You won't get the errors when your calculated value isn't what the
compiler allocates
2) When you add something to the struct in a later version, you don't have
to go through your code globally replacing '22' with '24' or whatever.
Regards,
Howard.
--
Howard Tomlinson - Game Developer, [EMAIL PROTECTED]
http://www.astraware.com/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/