Kade:

  Perhaps the following snippet will give you some ideas:

// note that this function leaves the record locked
// if and only if it returns 0 (no err)

Err YourUnpack(
  DmOpenRef pDb,        // IN database reference
  UInt16 index, // IN record index
  MLSDB * pRec) // IN/OUT pointer to struct, to be filled in
{
        Char* p;
        MemHandle h;
        Int32 len;
        
        h = DmQueryRecord(pDb, index);
        if (h)
        {
                MemSet(pRec, sizeof(MLSDB), 0);
                p = MemHandleLock(h);
                
                // date
                len = StrLen(p);
                pRec->date = p;
                
                // away
                p += len;
                len = StrLen(p);
                pRec->away = p;

                // etc., etc.
        }
        else
        {
                return -1;
        }
        return 0;
}
                

-----Original Message-----
From: Kade P. Cole [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 8:14 AM
To: Palm Developer Forum
Subject: Re: Palm PDB Database Help



I must not have explained it well. The Databse record in the PDB DOES
contain the character strings. The struct that I am using to access the DB
record is the one with the pointers in it.

Kade


On 4/2/02 9:51 AM, "Robert McKenzie" <[EMAIL PROTECTED]> wrote:

> Kade:
> 
> You have a basic C misconception here.
> 
> A DB record should (can only) contain that actual strings themselves, NOT
> pointers to them.

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

Reply via email to