If anyone could help with this, I'd appreciate it
I saw the following function in the O'Reilly's Palm Programming book. It is
found in the Sales Conduit. It is used to load Orders from the HH to the
deskstop.
Order *RawRecordToOrder(void *p)
{
PackedOrder *po = (PackedOrder *) p;
unsigned short numItems = SyncHHToHostWord(po->numItems);
Order *o = new Order(numItems);
o->customerID = SyncHHToHostDWord(po->customerID);
for (int i = 0; i < o->numItems; i++) {
o->items[i].productID = SyncHHToHostDWord(po->items[i].productID);
o->items[i].quantity = SyncHHToHostDWord(po->items[i].quantity);
}
return o;
}
where
struct Order{
Order(unsigned short num) { numItems = num;
items = new Item[numItems];};
long customerID;
unsigned long numItems;
Item *items;
};
typedef struct {
SDWord customerID;
Word numItems;
Item items[1]; // this array will actually be numItems
long.
} PackedOrder;
typedef struct {
DWord productID;
DWord quantity;
} Item;
My question is, How would I convert an Order Struct filled with data from
the desktop, to a Raw Record to be loaded in the Palm database since the
Order struct type has an array as a structure member? When initializing the
orders database within the Palm Program, DmWrite is called and the array
name is passed in. I cannot call this function in the conduit however. How
would I go about packing this Order struct?
Many Thanks
James Colletti
Retail Branch Systems
Salomon Smith Barney
212-723-3256