Hello,

I have to make a Palm database, I use the example of the O'REILLY book to help me.

It works fine but I don't know how to enter my own record in the database.

Here is the record structure :

typedef struct PackedCustomer{
   UInt16 customerID;
   Char  name[1]; // actually may be longer than 1
} PackedCustomer;

typedef struct Customer{
   UInt16      customerID;
   const Char *name;
   const Char *address;
   const Char *city;
   const Char *phone;
} Customer;


The autors use this to initialyse the database :

static void InitializeCustomers(void)
{
   Customer c1 = {1, "Joe's toys-1", "123 Main St." ,"Anytown",
      "(123) 456-7890"};
   Customer c2 = {2, "Bucket of Toys-2", "" ,"", ""};
   Customer c3 = {3, "Toys we be-3", "" ,"", ""};
   Customer c4 = {4, "a", "" ,"", ""};
   Customer c5 = {5, "b", "" ,"", ""};
   Customer c6 = {6, "c", "" ,"", ""};
   Customer c7 = {7, "d", "" ,"", ""};
   Customer *customers[7];
   UInt16  numCustomers = sizeof(customers) / sizeof(customers[0]);
   UInt16  i;
   MemHandle h;
   UInt16 index;
   Customer c1;
   customers[0] = &c1;
   customers[1] = &c2;
   customers[2] = &c3;
   customers[3] = &c4;
   customers[4] = &c5;
   customers[5] = &c6;
   customers[6] = &c7;



   for (i = 0; i < numCustomers; i++)
   {
      index = dmMaxRecordIndex;
      h = DmNewRecord(gDBC, &index, 1);
      if (h) {
         PackCustomer(customers[i], h);
         DmReleaseRecord(gDBC, index, true);
      }
   }
}


But I would like to fill my database on my own, I don't want this :  "  Customer c1 = 
{1, "Joe's toys-1", "123 Main St." ,"Anytown",
      "(123) 456-7890"}; "

I have tried this :
c1.customerID = 1;
StrCopy(c1.name,"test");

But on StrCopy, the compilation failed.

Is someone have an idea it would be extremely helpful.

Thanks in advance

Helene
------------------------------------------

Faites un voeu et puis Voila ! www.voila.fr


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

Reply via email to