I have searched through books, Palm Knowledge Base, and this forum for
DmQueryRecord. They all say the same thing:
Get handle, get pointer with MemHandleLock, *Use the database data*, and
then MemHandleUnlock.
My code:
static Err ReadDealStateFromDB()
{
Err err = errNone;
MemHandle recordHandle;
UInt16 index = gameState.LastDealRecord; // Always record 1 until
implement Undo/Redo
struct DealState *dState;
recordHandle = DmQueryRecord(gameDB, index);
if (! recordHandle)
err = DmGetLastErr();
else
{
dState = (struct DealState *)MemHandleLock(recordHandle);
MemMove(&dealState, dState, sizeof(dealState));
MemHandleUnlock(recordHandle);
}
ErrFatalDisplayIf(err != errNone, "Can't read deal state from database");
return err;
}
where my *Use the database data* is to MemMove from the database to my
global structure variable.
I have similar code to successfully write and read a global structure
gameState variable at index 0. However, my dealState structure is totally
bogus (there are no runtime errors, i.e., err is errNone).
Using VFDIDE, configured per the www.vfdide.com site.
prc-tools-2.0, cygwin-b20.1-full, SDK 4.0 Update 1.
What am I doing wrong? Am I misunderstanding the use of index as the record
number?
Thanks,
Al
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/