Listing 2. Cycling through Modified Records

{
  int db, len, I, attr;
  recordid_t id;
  unsigned char buffer[4096];

...open the connection...

  sd = pi_accept(sd, 0, 0);
  dlp_OpenDB(sd, 0, 0x40+0x80,
             "DateBookDB", &db);
  for (;;) {
    len = dlp_ReadNextModifiedRec(sd, db,
                       buffer, &id, &I,
                       0, &attr, 0);
    if (len < 0) break;
    printf(buffer); printf("\n");
  }
  dlp_ResetSyncFlags(sd, db);
  dlp_CleanUpDatabase(sd, db);
  dlp_CloseDB(sd, db);
  pi_close(sd);
}