Hi all,
I have been trying to write a very simple program. And I've met
with a large amount of difficulty which leads me to believe that I am
doing something very wrong.
All I want to do is write 3 strings to a pdb. Then I want to display
one of them. That's it. But, since I am planning on doing other stuff
eventually, I need to use a pdb.
Any ideas on how to do this? Or pointers to an example? I have
several examples that I thought would help, but they don't because they
are all for complex databases with multiple fields, editable data etc.
Here is a code snippet that doesn't work. I know that there has to be
something simple that I am missing, but I've been unable to find it...
void InitializeDB(void)
{
Char *recptr;
UInt16 length = 0;
MemHandle h1;
Messages m1 = {"This is message one"};
Messages m2 = {"Second Message here"};
Messages m3 = {"Third message here is"};
Messages *message[3];
UInt16 numMessage = sizeof(message) / sizeof(message[0]);
UInt16 i;
message[0] = &m1;
message[1] = &m2;
message[2] = &m3;
for(i = 0; i < numMessage; i++)
{
UInt16 index = dmMaxRecordIndex;
/* Creating the new record */
MemHandle h = DmNewRecord(gDB, &index, 1);
if(h)
{
length = StrLen(message[i]->msg) + 1;
if (MemHandleResize(h, length) == 0)
{
recptr = MemHandleLock(h);
DmWrite(recptr, 0, &(message[i]->msg), length);
MemHandleUnlock(h);
}
DmReleaseRecord(gDB, index, true);
}
}
}
Help or pointers to SIMPLE database examples (and the Contacts example
with the Falch ide isn't what I'd call simple) would be great.
Thanks again.
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/