StrLen gives you the length without the Null-Terminator, therefore you
should always be using StrLen()+1
LionScribe

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Steve K
Sent: Thursday, August 14, 2003 9:21 PM
To: Palm Developer Forum
Subject: DmWrite/DmGetRecord


Strange things are amuck in the Dm world for me today.

I hope this is something simple, but here goes.

I am still learning how to use the palm database and so I am making calls to
DmWrite and then to DmGetRecord to verify that all data is being accuratly
accounted for.

After making the DmWrite call, everything seems to be fine.
I am writing a null terminated string to the DB as a record.  (any better
way to do this?  I have ' ' delimited fields)  Anyway, using the debugger,
everything looks fine.

When I make my call to DmGetRecord, I get the record and everything is
great, except that there are extra characters at the end of my record, most
noticably is a strange cresent moon shape at the very end.  Where is this
data coming from?

I have narrowed it down, I think, to my call to DmWrite, maybe I don't
understand what it is asking for but this is what I am trying:
I have also tried what is in the commented area with s as the first param to
DmWrite, with the same results.

Boolean foo(char* data);
    Err errDb;
    UInt16 index = 0;

    MemHandle newRec = DmNewRecord(gDatabase, &index, StrLen(data));

    /*
    MemPtr s;

    if(newRec)
        s = MemHandleLock(newRec);
    else
        return false;
    */
    errDb = DmWrite(MemHandleLock(newRec), index, rec.RawData,
StrLen(data));

    errDb = DmReleaseRecord(gDatabase, index, false);
    MemHandleUnlock(newRec);

    return (errDb==errNone);
}

I will continue to play with this in the mean time, but any help is
appreciated.

tia,

Steve K



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



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

Reply via email to