> From: David Quek
>
> Can anyone briefly tell me how does palm database 'looks' like? I
> went thru
> the http://webdev.apl.jhu.edu/~rbe/kvm/ demo on the simple database
> creation. In the demo, each records always terminated by a '/0'.
>
When the Palm docs refer to a "database" they are really just talking about
a block of memory that consists of 1 or more records. As far as the OS is
concerned, there are no fields in a database.
> Let say, I've two fields, 'cust_name' and 'cust_'weight'.
> Q1) How does 'cust_name' and 'cust_weight' looks like? Are there any
> seperator between the two fields?
>
Since there aren't really any fields in a database, it is up to you to
decide how you want to arrange the contents of each record into "fields".
The obvious way to store a name and a weight would be to use a
null-terminated string for the name and an unsigned integer for the weight,
but you could use another method if you want (e.g., two strings, as you
suggested above).
> Q2) How can I read each of the fields in the records? As I know both the
> field's length is variable(not fix).
>
If you know what you stored in each record, then you should know how to read
it. If it's somebody else's program and they don't publish the data
structure, then you have to do "reverse engineering", but hopefully that is
not what you are trying to do.
If you are reading variable length strings that are packed together in
memory, then you have to read each character until you find the terminating
'\0' to unpack the strings.
> Can anyone share a simple program about write/read from a DB and
> display at the screen? I'm very new to all this.
>
The SDK includes the source code for the resident Palm programs (To Do,
Address Book, etc.). These are a bit complex if you are just learning, so
you might do better by getting a book on Palm programming. Two that I like
(though they are getting a little out of date) are "Palm Programming - The
Developers Guide", by Rhodes and McKeehan and "Palm OS Programming for
Dummies" by O'hara and Shettino. There are many others.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/