> From: adam davies
>
> What are the DB_ITEM and DB_QUANT that you think take 2 bytes each?
> You should post the code you use to write a db record.
>

What I was trying to ask last time was:  what is the actual structure of
each database record, and how are you writing it to the database?  It
appears that you are attempting to write a fixed-length data record to your
db.  The simplest way to do that is something like the following:

// db record
typedef struct
{
  ULong id;
  UInt16 item;
  Int8 qty;
} dbRecord, *dbRecordPtr;

UInt16 dbRecordSize = sizeof(dbRecord);
dbRecord dbr;

Assign values to the structure members (dbr.id, etc.), then to write out a
single record, use something like this:

DmWrite( precord, 0, &dbr, dbRecordSize );

Your code defined a lot of constants for the size of each item in the record
and then summed them up to get the total record size.  This method is risky
unless you are certain of each size (that's why I was wondering about the
2's).  Instead of using constants, it is better to use sizeof(dataType) to
get each length.  As you can see, the above code is much simpler, though it
may waste some space if the compiler has to pad the structure for alignment.

I noticed that you are using 'pos' for the database type.  Normally, you
should use 4 chars (it's really a UInt32).  I don't know if that causes any
problem, though.

The way you handle sysAppLaunchCmdGoTo looks strange to me.  You might want
to look at the code for Address Book (or one of the other Palm apps) to see
how it is usually done.

I hope something I've said helps.



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

Reply via email to