> "Scott Rock" <[EMAIL PROTECTED]> wrote in message > > I'm writing an application for PalmOS using Codewarrior. My app needs to > > read in about 20 records of data. Each record will have a name string and > > a visited boolean variable. When the app starts up, I'd like to read this (snip) > > What is the easiest way to do this? Should I create a pdb database file, > > use a text file to read into a list, or hard-code the 20 items into my > > program (since they won't be changing)? > From: "Tim Kostka" <[EMAIL PROTECTED]> > The easiest way is to use the preferences, as long as your data is > relatively small. It's straightforward, store the data on exit and retrieve > it on entry. You should be able to find examples if the documentation isn't > enough. > Except that these preferences will still have to be initialised from somewhere, leading to the same question about where is the data stored? If it's hard-coded into the app for initialisation why copy it to preferences?
Hard-coding a data array is the easiest approach and if you wrap this data array in a module of it's own with Get functions you'll be able to alter this later without changing the rest of the app. You should also code an init and terminate function and call them on your app start and stop so that if you change to a method that needs to open a database or release memory on exit that the initial implementation has those connection points in place. The only problem I can see with hard-coding these values is that updating them requires issuing another application version - you can't just provide a new database for download. For the amount of data you're talking about the side-effects should be minimal. Chris Tutty -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
