Hello,
I'm fairly new at C for Palm and Palm programming. I need some help with
recording strings in databases. Right now I just want it to work, and don't
really want to deal with any packing until later.
I have an error message I want to store, and it is part of a larger struct:
typedef struct
{
char *note;
enum ErrorLevel level;
Boolean read;
} ErrNote;
As you can see, note is a string pointer. Now I have all of my error
messages as string literals: "lasdkf". I copy them one by one, depending
upon which are needed, into a tempory string array: noteText[300]. My
problem is getting the data from noteText into ErrNote note.note. In order
to use StrCopy, I must reference the *note pointer to some memory block. The
initial copying appears to work fine. I then copy ErrNote note to the
database using DmWrite, and then the string as well, using DmStrCopy. The
error results when I attempt to read back that same string from the
database. It seems that it wants to use the same memory block I had first
referenced it to, which now no longer exists. Therefore, I receive many
memory errors of it attempting to access memory incorrectly. If I leave the
memory block as is, locked and don't free it, it works fine, but I then have
a memory leak.
Can anyone please help me find a way to copy the contents of noteText into
ErrNote note.note?
Thanks,
Yogesh Saletore
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/