christy wrote:
Can you give an example call to Unpack()? My database
has two fields (id - integer and name - chars)
When reading a record, you only have to lock it then
you can read it.

try this structure for the record instead:

typedef struct {
  UInt16 fid;
  char   fname[];
}FDBRecordType;

what's happening is your pointer isn't pointing to
the right place. making it an array should work better.


"Ben Combee" <[EMAIL PROTECTED]> wrote in message
news:<103778@palm-dev-forum>...

Here is the Stucture for the database record:

typedef struct {
UInt16 fid;
char  *fname;
}FDBRecordType;
You cannot store character pointers in a DB
effectively -- if that's pointing to memory on the
dynamic heap, there's no guarantee that the pointer
will still be valid on later runs of the program. You
need to store a copy of the field name in the record
and use some sort of pack/unpack mechanism to get
access to the string.

--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to