I have written an application that writes 40 byte records to a Palm
database. All the records are being written correctly, however, it is
imperative that they remain in the order that I write them to my database.
When i pull the DB off the palm pilot and look at it with a hex editor, it
looks like they are being sorted in some numerical fashion. I have not
specified in my code anywhere to sort these 40 byte records. Is there
something I can do to stop this, or change it so that each 40 byte record
stays in the order in which I have added it? Here is a snippet of the code
I use:
static void storePacket()
{
CharPtr text;
VoidPtr textPtr;
VoidHand textHandle;
UInt index = 0;
UInt recordLength;
if (DmNumRecords(PocketEtcDB) > 0)
{
CurrentRecord = DmNumRecords(PocketEtcDB);
index = CurrentRecord - 1;
} else { index = 0; }
text = currentPacket;
recordLength = 40;
// Is there data in the field?
if (text != NULL && *text != 0)
{
textHandle = DmNewRecord(PocketEtcDB, &index, recordLength);
textPtr = MemHandleLock(textHandle);
DmWrite(textPtr, 0, text, recordLength);
MemHandleUnlock(textHandle);
// Release the record to the database manager.
DmReleaseRecord(PocketEtcDB, index, true);
// Hold the index of the record we've just created
justEditedRec = index;
}
StrCopy(currentPacket, "");
}
Thanks in advance for any suggestions.
Joe Jenkins
Software Engineer
Qqest Software Systems