Hello ..

sorry, i guess i just made a mistake in the copy and paste ... here are the
detials of the data structures :

typedef struct {
     UInt orderID ;
     ULong timeStmp ;   // stored as seconds
    CharPtr name ;
    CharPtr address;
     UInt totalQuantity ;
     int expMonth;
     int expYear;
} CustomerType ;

typedef CustomerType *CustomerPtr ;

typedef struct {
     UInt orderID ;
     ULong timeStmp ;   // stored as seconds
     UInt totalQuantity ;
     int expMonth;
     int expYear;
    Char custData ;
} PackedCustomerType ;

typedef PackedCustomerType * PackedCustomerPtr ;

code snippet :

CustomerPtr src ;
PackedCustomerPtr dest, nilP = 0;

custHandle = DmNewHandle(size);
dest = (PackedCustomerPtr) DmHandleLock(custHandle) ;

 err = DmWrite(dest, (ULong)&nilP->orderID, &src->orderID ,
 sizeof(src->orderID));
  ErrFatalDisplayIf(err, "Couldnot pack record");
  err = DmWrite(dest, (ULong)&nilP->timeStmp, &src->timeStmp,
 sizeof(src->timeStmp));
  ErrFatalDisplayIf(err, "Couldnot pack record");
  err = DmWrite(dest, (ULong)&nilP->totalQuantity, &src->totalQuantity,
 sizeof(src->totalQuantity)) ;
  ErrFatalDisplayIf(err, "Couldnot pack record");

 err = DmWrite(dest, (ULong)&nilP->expMonth, &src->expMonth,
sizeof(src->expMonth)) ;
 ErrFatalDisplayIf(err, "Couldnot pack record");

problem : the last DmWrite() gived a dmErrNotValidRecord message.



Bob Whiteman <[EMAIL PROTECTED]> wrote in message
news:20972@palm-dev-forum...
>
> You haven't shown what src, nilP and tmpare, but one thing I noticed is
that
> your first three DmWrites use nilP for the 2nd argument but the fourth
> DmWrite uses tmp for the 2nd argument. What is tmp?
>
>      -Bob Whiteman
>
> > -----Original Message-----
> > From: Kshama Sathaye [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, August 14, 2000 12:51 PM
> > To: Palm Developer Forum
> > Subject: DmWriteCheck fails.
> >
> >
> > Hello,
> >
> > I'm trying to write to a locked handle using DmWrite, but for
> > some reason, I
> > keep getting the dmErrNotValidRecord error and I have no clue
> > how to fix it.
> > Help is greatly appreciated.
> >
> > Here is what i'mdoing.
> >
> >
> > custHandle = DmNewHandle(size);
> > dest = (PackedCustomerPtr) DmHandleLock(custHandle) ;
> >
> >  err = DmWrite(dest, (ULong)&nilP->orderID, &src->orderID ,
> > sizeof(src->orderID));
> >  ErrFatalDisplayIf(err, "Couldnot pack record");
> >  err = DmWrite(dest, (ULong)&nilP->timeStmp, &src->timeStmp,
> > sizeof(src->timeStmp));
> >  ErrFatalDisplayIf(err, "Couldnot pack record");
> >  err = DmWrite(dest, (ULong)&nilP->totalQuantity, &src->totalQuantity,
> > sizeof(src->totalQuantity)) ;
> >  ErrFatalDisplayIf(err, "Couldnot pack record");
> >
> >   err = DmWrite(dest, tmp, &src->expMonth, sizeof(src->expMonth)) ;
> >   ErrFatalDisplayIf(err, "Couldnot pack record");
> >
> > here .. while the first 3 DmWrite()s work, the 4th one doesnot !!
> >
> > should the datatypes matter ??  should the order of DmWrite
> > matter ?? and if
> > the record is invalid, how do the first 3 work ??
> >
> > Any help is appreciated .. I just dont know how to proceed if
> > this thing
> > fails !!
> >
> > thank you ..
> > -kshama
> >
> >
> >
> > --
> > For information on using the Palm Developer Forums, or to
> > unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
> >
>
>



-- 
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