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/

Reply via email to