On 10/9/05, Del Ventruella <[EMAIL PROTECTED]> wrote:
> Is the corresponding load sequence:
>
> void LoadData(DmOpenRef db, myStructType *myStructP){
> MemHandle recH=NULL;
> UInt8 *recP;
> UInt16 recIndex=-1; //will save the data in a new record at the
> end of the database
>
> RecH=DmNewRecord(db, recIndex, sizeof(myStructType));
> if (recH){
> recP=MemHandleLock(recH);
> DmRead(recP,0,myStructP, sizeof(myStructType));
> }
> }
>
> ?
>
> One other question, the part about saving the pointer data.
>
> The pointer contains the address of the data.
yes.
> Under PalmOS, there is no hard drive where this data safely resides.
palmos has a special memory management system that stores both
dynamic memory and storage memory in the same space - there is
no file system (like windows), but you can open/close files and a
layer if provided for record/resource level access.
> If the address is overwritten, you lose the data. Okay, that I understand.
yes.
> How does one store (and load) this pointer data
DmGetRecord, MemMove combination (opposite of DmNewRecord, DmWrite)
> in a manner that will insure that it is retained?
it wont be retained in the same memory location (unless you save/load
at same time)
however, the contents should be mirrored with a MemMove.
i would recommend you download the SDK documentation and take a look at
the PalmOS Companion section and give it a quick read over. it may take a little
longer to read everything; but, the document does a pretty good job at covering
the basics of how memory is managed and gives appropriate advice and
examples on how to do so.
i purchased this in hardcopy back in 1999 when fatbrain.com was doing
hard copies and its been the most valuable reference i've ever used. i also
used to do a lot of international flights so i had plenty of time to
give it a read :)
--
// Aaron Ardiri
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/