I took one more look at this, and your second version of the code is
incorrect as well.

The line of code that writes to the database should be:

error = DmWrite(p, 0, q, StrLen(q));     (instead of &q)

Sorry for the confusion...

Dave

"Dave Lasker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Your new code is correct. The actual string is copied into the database.
>
> Dave
> "meg" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> >
> > Thanks Dave, for the reply.  (and Lion).
> >
> > I figured that I couldn't use the handle.  One more question - does the
> > DmWrite function copy the actual bits written at the adress it is given,
> or
> > does it just note the address?  For instance, if I changed my code to
what
> I
> > have shown below, would it actually copy the words from the string into
> the
> > database, or would it simply note the pointer?  In other words, once the
> > pointer q is no longer valid, would the values stored in the database
> still
> > be valid?
> >
> > Thanks,
> > meg
> > **************************code********************************
> > typedef struct {
> >   MemHandle QuestionAnswers;
> >   UInt8 sessionFinished;
> > } packed_question_type;
> >
> > //part of save database routine
> >
> >         //grab data from handle for packed question
> >         q = MemHandleLock (packedQuestion.QuestionAnswers)
> >
> >         error = DmWrite(p, 0, &q, StrLen(q));
> >
> >         MemHandleUnlock(packedQuestion.QuestionAnswers);
> >
> >
> >
> >
>
>
>
>



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

Reply via email to