"Roberto Amorim" <[EMAIL PROTECTED]> wrote in message
news:9942@palm-dev-forum...
> { Char *NrPed;
>   Char *CdMtv;
> } StruRegPed;

This is just two pointers, total size 8 bytes.

> iSize= StrLen(RegPed->NrPed)+1+StrLen(RegPed->CdMtv)+1
> hNewReg = DmNewRecord(PVPed, 0, iSize);
> reg=MemHandleLock(hNewReg);
> DmWrite(reg, 0 , RegPed , sizeof(iSize));

sizeof(iSize) is 2 or 4, depending on how you declared it. So this will
write the first 2 or 4 bytes of the StruRegPed structure. If you used
sizeof(RefPed), you'd be writing the entire RegPed structure, but this is
just two pointers. No characters would be written out.

Replace the last DmWrite with a pair of DmStrCopy calls, one for each
string. The first one should write to the beginning of the record (ie. reg).
The second one should start after the null terminator for the first string
(ie. reg + StrLen(RegPed->NrPed)+1).

Records are in the storage heap. To write to the storage heap, you must use
Dm calls. Use DmWrite if you know how many bytes to write. (You could use it
here.) Use DmStrCopy if you're writing a string (ie. up to and including a
null byte).
--
Danny Epstein
OS Engineer, Palm Inc.


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to