Thank you much, Robert. 

--- Robert McKenzie <[EMAIL PROTECTED]>
wrote:
> christy-
> 
>   You need to actually get the record and check for
> equality.  i.e.  
> 
> /*  use DmFindSortPosition here, passing it (amongst
> other things), &index *.
> 
> Boolean foundIt = false;
> // guard against no match whilst sorting first
> if (index > 0)
> {
>       MemHandle h = DmQueryRecord(pDb, --index);
>       if (h)
>       {
>               MemPtr p = MemHandleLock(h);
>               foundIt = CompareIDFunc(p, &findRecord) == 0;
>               MemHanleUnlock(h);
>       }
> }
> 
> if (foundIt)
> {
>       /*  do whatever you want here */
> }
> 
> 
> -----Original Message-----
> From: christy [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 17, 2002 3:17 PM
> To: Palm Developer Forum
> Subject: RE: DmFindSortPosition question
> 
> 
> Very good point. I modified the code to have the two
> variables compare against each other.
> 
> I need to find a matching record from the databse
> (by
> fid and sid pair). If there is a match, I can
> subtract
> 1 from the return-value of DmFindSortPosition.
> However, how do I know that there is in fact no
> match
> for fid + sid pair? DmFindSortPosition tells me the
> next available position. It didn't indicate whether
> or
> not a match is found. Am I using the wrong function
> all together?
> 
> --- Robert McKenzie <[EMAIL PROTECTED]>
> wrote:
> > Just a guess, but because of possible wrapping /
> > overflow problems, it is always safer to compare
> two
> > values with each other rather than to subtract
> them
> > and compare with 0.
> > 
> > I.e.  
> >  if (p1->fid < p2->fid) is better than if
> ((p1->fid
> > - p2->fid) < 0)
> > 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
> 
> -- 
> For information on using the Palm Developer Forums,
> or to unsubscribe, please see
> http://www.palmos.com/dev/support/forums/
> 
> 
> --
> For information on using the Palm Developer Forums,
> or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

Reply via email to