Errr.. I meant originally locked and later unlocked.

--------------------
Jeff Loucks
Mobile 253-691-8812


-----Original Message-----
From: Jeffry Loucks [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 08, 2005 4:05 PM
To: Palm Developer Forum
Subject: RE: Reading AppInfo block in DB


You have incremented appInfoP, so it no longer points to the originally
allocated memory. Save the pointer someplace to use in free().

--------------------
Jeff Loucks
Mobile 253-691-8812


-----Original Message-----
From: Jim Duffy [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 08, 2005 3:57 PM
To: Palm Developer Forum
Subject: Reading AppInfo block in DB



Hi All,

I'm having trouble reading the app info block in my DB.

I've written this kind of code before and it works fine when the AppInfo 
block is of a known size that can be directly assigned to a C struct. 
However, in this particular database, the app info block can be of an 
arbitrary size..

I get the app info pointer like so:
appInfoP = (char*)MemLocalIDToLockedPtr(appInfoID, cardNum);

I then assign some local variables with the data contained in the app info 
block by cycling through the pointer.

Like:

// number of strings
groupList.SetCount(*appInfoP);
appInfoP++;
// read each string
for(int j = 0; j < groupList.GetCount(); j++)
{
    do
    {
         groupList[j]+= *appInfoP;
         appInfoP++;
     }
      while(*appInfoP != '\0');
      // skip over null byte
      appInfoP++;

After doing this I call:

 MemPtrUnlock(appInfoP);

However, my application crahses as soon as the call to unlock the pointer is

made..

If I get the lock pointer and then immediately unlock it without reading any

values, it doesn't crash..

Does anyone know why this is happening and how I can resolve the issue?

Thanks for the help in advance,

Jim



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

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

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

Reply via email to