[EMAIL PROTECTED] wrote:
Logan Shaw <[EMAIL PROTECTED]> wrote ..
druid wrote:
Yea, but that brings up another question
If the structure of a record is actualy a series on
teminated strings, when you retrieve records, how do you
know the length of any field in that record
You just have to figure out a way to do this yourself.
You mean that a record is not normally just a single string
with delimiters
That's right. A record is a chunk of memory, and you can format it any
way that you like. You CAN choose to delimit it with NULL characters,
as you have done below by specifically including the trailing NULLs in
the DmWrite commands.
Like this
size = StrLen(name)+1+ StrLen(level)+1;
index = dmMaxRecordIndex;
h = DmNewRecord(dbPtr, &index, size);
ptr = MemHandleLock(h);
Offset = 0;
DmWrite(ptr, Offset, (const void *)name, StrLen(name)+1);
Offset += StrLen(name)+1;
DmWrite(ptr, Offset, (const void *)level, StrLen(level)+1);
err = DmCloseDatabase(dbPtr);
maybe im doing this all wrong
This stuff seems to look OK, as long as you have previously defined all
those variable types correctly.
How do you know the length of any field? Using the method above, the
only real way is to iterate through the record, looking at each string
in turn.
Bob
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/