One more way not yet mentioned: prefix each field w/ a type byte, e.g.
#define I16 0x01
#define I32 0x02
#define STR 0x03
...
Then when you read the record, check the first byte ... let's say this
value is 2 ... this will tell you that the first field is a 32-bit integer.
Ok,
so the next 4 bytes is the data for that field. The byte after that is the
type byte for the following field ... repeat until you run out of data
in your record.
--
-Richard M. Hartman
[EMAIL PROTECTED]
186,000 mi/sec: not just a good idea, it's the LAW!
Yu, Ken wrote in message <13645@palm-dev-forum>...
>
>Another way is the method used by the built-in apps (eg AddressBook). Bit
>fields are used to indicate if a field exists in the record. I find that
>this method is best for memory conservation. You won't waste a byte for
>each empty field when using deliminators and fixed length always causes
>maximum memory usage for each field. Memory is a important concern when a
>database can potentially contain numerous records. Even saving one byte
per
>record can make a huge difference.
>
>> ----------
>> From: Steve Austin[SMTP:[EMAIL PROTECTED]]
>> Reply To: Palm Developer Forum
>> Sent: Wednesday, June 07, 2000 2:55 PM
>> To: Palm Developer Forum
>> Subject: RE: Number of Fields
>>
>> There are two basic ways to keep track of "fields" in a record. Either
>> you've got to use some kind of delimeter, or you've got to keep track of
>> the
>> size of each field. It's your choice.
>>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/