I believe 
#pragma packed

forces packed structs. Otherwise there is no requirement in c/c++ for a
stuct to be packed in the smallest number of bytes. 



-----Original Message-----
From: Brian Smith [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 1:30 PM
To: Palm Developer Forum
Subject: Re: record size and writing to database


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
>  UInt16 area;           //max value =  999,  2 bytes
>  UInt16 method;         //max value =  999,  2 bytes
>  UInt16 station;        //max value =  999,  2 bytes
>  UInt16 effort;         //max value = 9999,  2 bytes
>  } 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.


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to