Try using OffsetOf( DriverLogRec_t, StatusErrorComment.DutyStatusCode ) to calc the offset for the second parameter to DmWrite.

spike

>From: "Richard.Johnstone" <[EMAIL PROTECTED]>
>Reply-To: "Palm Developer Forum" <[EMAIL PROTECTED]>
>To: "Palm Developer Forum" <[EMAIL PROTECTED]>
>Subject: Why o Why won't this work????
>Date: Thu, 14 Jun 2001 14:56:56 -0400
>
>I am running this function
>
>static void updateRecordComments(ErrorComment comment) {
>
> //update the record in the database
> VoidPtr recH;
> BothRecordsPtr recP;
> BothRecordsPtr nilPtr = NULL;
>
> recH = DmGetRecord(DriversLogDB, insertpoint);
> recP = MemHandleLock(recH);
>
> DmWrite( recP,
>(UInt32)&nilPtr->DriverLogRec.StatusErrorComment.DutyStatusCode,
>&comment.DutyStatusCode, sizeof(UInt32) );
> ! DmWrite( recP, (UInt32)&nilPtr->DriverLogRec.StatusErrorComment.Timestamp,
>&comment.Timestamp, sizeof(UInt32) );
> DmWrite( recP,
>(UInt32)&nilPtr->DriverLogRec.StatusErrorComment.ErrorLogDate,
>&comment.Timestamp, sizeof(UInt32) );
> DmWrite( recP,
>(UInt32)&nilPtr->DriverLogRec.StatusErrorComment.ErrorComments,
>&comment.ErrorComments, sizeof(UInt32) );
>
> // unlock and release and set the dirty bit
> MemHandleUnlock(recH);
> DmReleaseRecord (DriversLogDB, insertpoint, true);
>
>}
>
>The first write works fine but after that I get bits of the data. Surely
>that means there is something wrong with the sizeof but I can't work it out!
>I have tried finding the size of each field and then passing this in. No
>Joy!
>Also, why can't I just save the whole structure instead of having to do each
>field. Again,! this didn't work!
>
>Help Please.
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/


Get your FREE download of MSN Explorer at http://explorer.msn.com

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

Reply via email to