Please ignore my previous post (too late, I know!).  I accidently sent
it before finishing my response.

--- Carmen Sandiego <[EMAIL PROTECTED]> wrote:
> The following code is from a Palm OS book.  I am using 
> this to determine the total number of databases stored 
> with a particular creator ID & type.
> 
> if (DmGetNextDatabaseByTypeCreator(true, &searchState, 
    myType, myCreator, false, &cardNo, &dbID)
> {
>   do {
>      count++
>   } while (DmGetNextDatabaseByTypeCreator(false,
>      &searchState, myType, myCreator, false, &cardNo, &dbID);
> }
> 

This code looks wrong.  DmGetNextDatabaseByTypeCreator() returns
errNone (0) if there is no error, and it returns dmErrCantFind (not 0)
if it can't find any matching dbs.  Plus, I don't see how you could
compile it without at lease a compiler warning because the parentheses
are not matched.

Therefore, I think the code should be:

if (DmGetNextDatabaseByTypeCreator(true, &searchState, 
     myType, myCreator, false, &cardNo, &dbID) == errNone)
{
  do {
     count++
  } while (DmGetNextDatabaseByTypeCreator(false,
     &searchState, myType, myCreator, false, &cardNo, &dbID) 
     == errNone);
}

I haven't tested this code, so I might have made a mistake, but I
believe it is correct.  Why don't you try it?


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards�
http://movies.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