Listing 3. Pack Function

{
  int app_size, len;
  recordid_t palm_id, new_id;
  unsigned char buffer[512];
  struct Appointment app;

...

  strcpy(app.description,"Something to do");
  app.begin = ...
...
  size = pack_Appointment(&app,
                          buffer, 512);
  palm_id = 0;
  len = dlp_WriteRecord(sd, db, 0, palm_id, 0,
           AppBuffer, Appointment_size, &new_id);
  printf("the new id is %d",new_id);
}