From: "Michael Sendrove" <[EMAIL PROTECTED]>
>     voltagetxt = MemPtrNew(sizeof(Char [5]));
>     record = DmNewRecord(PalmoscopeDB, &index,
> (samples*StrLen(voltagetxt))+1+(StrLen(&recordname[0])));
etc...

You are not allocating enough memory for voltagetxt.
sizeof(Char[5]) appears to return 0 (under CW 6).

Are you wanting space for 5 chars?  If so, then use
    voltagetxt = MemPtrNew(6);
to allocate space for 5 chars plus the \0.

Or, to allocate space for voltagetxt, use
    ptr = MemPtrNew(StrLen(voltagetxt)+1);
but, of course, if voltagetxt itself is not an allocated CharPtr pointing to
a zero-terminated string of chars, then it makes no sense trying to get its
length.

Also, if you have written "samples" strings, each of the same length, the
offset would have to be
    samples*(StrLen(voltagetxt)+1) since each string will have a \0 at the
end.

Also, I believe that when you write a string with DmStrCopy, a \0 is written
at the end.  Therefore, you have to increase the index to account for it,
e.g.,
    index += StrLen(voltagetxt) + 1;



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

Reply via email to