So is using the NULL type of delimiting faster or using
Char var1 = "test";
Char var2 = 25";
typedef struct
{
Char name[64];
Char level[64];
} QuestType;
QuestType Appt:
StrCopy (Appt.name, var1);
StrCopy ( Appt.level, var1);
blah, blah, blah.........
this would make reading back the record easier, but seems it would
have limitations and some wasted memory space. But you would allways
know the offset IE names data 0-63 levels data 64-127
Robert Moynihan <[EMAIL PROTECTED]> wrote ..
> [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/
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/