You have to allocate memory for text and another variables.
"G. Laurent" wrote:
> My application crash while using this function....what am I doing wrong ?
> (I just want to save a field text and a string to the same record.... If
> there's a simple way to do this, please tell me !)
>
> void EditSaveData(FieldPtr fldP)
> {
> CharPtr text;
> VoidHand newHandle;
> UInt idx = 0;
> VoidPtr pDBRec;
> DateTimeType dt;
> CharPtr chDateCodeSaisi = "", chTmp = "";
>
> newHandle = DmNewRecord(CodesDB, &idx, 30);
> pDBRec = MemHandleLock(newHandle);
>
> text = FldGetTextPtr(fldP);
> FldSetTextHandle(fldP, 0);
>
> if (text != NULL && *text != 0)
> {
> StrPrintF(chDateCodeSaisi, "00");
>
> DmStrCopy(pDBRec, 0, text);
> DmStrCopy(pDBRec, StrLen(text)+1, chDateCodeSaisi);
> MemHandleUnlock(newHandle);
> DmReleaseRecord(CodesDB, idx, true);
> }
> else
> {
> DmRemoveRecord(CodesDB, CurrentRecord);
> CurrentRecord = noRecordSelected;
> }
> }
>
> Thanks
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see
>http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/