Well, you're not checking that MemHandleLock() returns a valid pointer. What type is dealState? I think it is unlikely that you have that as a struct * instead of a struct, but if so, that would cause your problem. The record index is 0 based, I assume you know that too.
I don't think any of those are your problem but it's possible I guess. "Albert J. Franklin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > 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? -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
