On 2/8/00 9:04 AM, [EMAIL PROTECTED] at [EMAIL PROTECTED]
wrote:

> Due to a huge amount of data records I plan to download into a pilot DB I'm
> seeking for the best approach of storing my data efficiently (verry
> efficiently...)
> 
> My records now do have many fields such like
> Char Descr [255]
> Char Msg [30]
> Char Name [55]
> and so on
> 
> whereby I often use much less than the defined number of chars - so I know I
> waste a lot of space.
> 
> I wonder if it is possible to change my record layout to actualy point to a
> string DB that holds variable length records containing these strings.
> 
> Is this possible (varible lengths records).
> 

It is absolutely possible (and the normal practice). Look at any of the Palm
programming books, or the sample code for the built-in apps. They all use
some record packing.

In general, the idea is that you add up the length of the fields you are
going to write (allowing for the null terminator for strings) and then copy
the data into a record which has been resized to the necessary length.

Just be careful with structs, as the compiler may insert padding for
byte-alignment purposes, which wastes a (usually) small amount of space as
well. If you copy each data element into the record, you can avoid even that
amount of wasted space.

Best regards,

  -- Lou
_________________________________________________________________
Lou Krieg, President                          Tel: (802) 865-2728
Green Mountain Software Corporation           Fax: (802) 865-2468
85 Prim Road - Suite 302, PO Box 700       Internet: [EMAIL PROTECTED]
Colchester, Vermont 05446-0700                http://www.GMSW.com



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

Reply via email to