Peter wrote: > Can i not store this information in the application preferences block? > The real problem i have, is how to pack and unpack the data to/from > the database record or if possible from the application prefrences > block.
Well, if it's information that's global to the application, then yes, that's appropriate. Or there is the app info block, which is in the header of any database you create for your application. > Could you please point me to the place in the address-application > where this is done? Try doing a search within the files for the word "Pack." I think you'll find it ;-) (I know, the app looks big and intimidating at first. There's lots more going on in that app than first meets the eye.) It will show you how to go back and forth between the structured data (with char pointers) that's easy to work with in your code and the "packed" representation of what is in the storage heap, which holds one string right after the other in memory (with null terminators separating them, of course). The struct that you use for the packed data type will just have a char that is a placeholder to the beginning of the first string in place of all the char *s in the unpacked structure. If there is a chance that some strings will be empty (as in the case of the Address app) the packed structure will also contain a member that is a flag type, defined as a union of (for example) a UInt16 and up to 16 bitfields. The bitfields are flagged or cleared when there is a change in the data to indicate which string fields contain data. The routines for flagging and checking the flags need to be part of your pack and unpack functions if empty fields can exist. The idea is to avoid having to save data in a structure with big character arrays that frequently would have lots of unused space. If you haven't done stuff like this before and have trouble sorting through the Address app code, Lonnie Foster's Palm OS Programming Bible goes into it in some detail, and he has an example application of his own that shows what's involved. Even if you don't buy the book, the app source code is pretty well commented and worth a look. I'm sure you can find the companion site if you Google for it and download the source. The app is called Librarian. David ========================= David Beers Pikesoft Mobile Computing www.pikesoft.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
