> Kind of a newbie question, I guess:  I'm trying to
> write four strings into a record with four fields. 

Your example is confusing as you say you're writing a string,
yet your header is 4 characters.

If you're really writing strings (multiple characters) to the
database, then you need to do the DmGetRecord and then loop
over the length.  For example, if you want to write the third
string:

Char *str, *record;
UInt16 offset;

h = DmGetRecord(db, idx);
record = (Char *)MemHandleLock(h);

// Find how long the first string is.  Add one so you skip over
// the \0 which ends the string.
offset = StrLen(record) + 1;

// Now move that far forward in the record
record += offset;

// Find how long the second string is.
offset += StrLen(record) + 1;

// Move over it as well
record += offset;

// len is now the offset into the record of where to write the
// third string
DmStrCopy(record, offset, "your new value");



Note that I'm not checking out of bounds conditions here, and I've
now corrupted the following records.  You basically need to loop
over it the first time and copy out the strings (MemPtrNew()) into
temp variables, then rewrite it entirely with all 4.  You will
likely have to resize your record as well.  If that doesn't make
sense mail back.

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

Reply via email to