How about the record size?

SB> I use the below code to write records to the db. The problem
SB> occurs at the line (at the end)
SB> DmStrCopy(p, StrLen(keyn) +8 +1, note);

SB> This raises a "DmWriteCheck failed" error when the String in
SB> (Char *) note is larger than 27 chracters. 

SB> Any ideas?

SB> Btw I read the text from a field and store it into Char *
SB> note. Char * keyn is the first 40 characters of the same text. 

SB> Greets 
SB> Benjamin


SB> Char * note;
SB> Char * keyn;

SB> fldLen = FldGetTextLength(fld);
SB> note = MemPtrNew (fldLen + 1);
SB> GetFieldText (EditView, EditMemoField, note);

if (fldLen >>= 40)
SB> {
SB> keyn = MemPtrNew (41);
SB> StrNCopy (keyn, note, 40);
SB> }
SB> else
SB> {
SB> keyn = MemPtrNew (StrLen(note) + 1);
SB> StrCopy (keyn, note);
SB> }

SB> h = DmGetRecord (MemoDB, CurrentRecord);
SB> p = MemHandleLock (h);
SB> u32Value = 0;
SB> DmWrite (p, 0, &u32Value, 4); // noteLength
SB> DmWrite (p, 4, &u32Value, 4); // reserved
SB> DmStrCopy(p, 8, keyn);
SB> DmStrCopy(p, StrLen(keyn) +8 +1, note);

SB> MemHandleUnlock (h);
SB> DmReleaseRecord (MemoDB, CurrentRecord, dirty);




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

Reply via email to