What is the value of "pos"? Is it zero perhaps, which would mean you are
attempting to access an index value of -1?
Mitch Fawcett
Tapn'see Software
Home of SuperList2
http://www.tapnsee.com
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of xfguo
> Sent: Sunday, February 18, 2001 1:26 AM
> To: Palm Developer Forum
> Subject: how to call DmGetRecord()
>
>
> Some error occur when I call DmGetRecord() func. the source like this:
>
> static void ModifyRecord( UInt objIndex, UInt idx )
> {
> UnknownRec rec, *pRec;
> UInt pos;
> VoidHand hRec;
> Int16 selected;
>
> rec.index = idx;
> rec.secs = TimGetSeconds ();
> selected = GetInfo( objIndex );
> pos = DmFindSortPosition( UnknownDB, &rec, 0, (DmComparF *)
> CompareRecFunc, 0 );
> hRec = DmGetRecord( UnknownDB, pos - 1 );
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~error!
> pRec = MemHandleLock( hRec );
> if ( pRec->index == idx ) {
> if ( selected ) {
> rec.times = 3;
> } else {
> rec.times--;
> }
> DmWrite( pRec, 0, &rec, sizeof(rec) );
> } else {
> if ( selected ) {
> addUnknown( idx );
> }
> }
> MemHandleUnlock( hRec );
> DmReleaseRecord( UnknownDB, pos - 1, true );
> }
>
> When DmGetRecord() was called, pos = 2 & UnknownDB had been opened.
> Do someone can tell me why? Thanks!
>
>
> --
> 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/