Hi,
How can I store some string values in storage database without going through
Data manager functions.
I want a char* to a string stored on the storage heap, so that I can assign
this pointer to other records I am storing in the database.
How can I do this?
Thanks in advance.
Sridhar
> From: K.Sridhar Babu
>
> struct {
> UInt32 id;
> Char* text;
> }r;
>
> I store records of this struct type in database.
>
> 2. Is it possible to change some fields in a struct.........like
> r* p = MemHandlelock(recHandle);
> MemMove(text,recPtr->text,sizeof(recPtr->text)+1);
>
> But it is nor working?
>
> r* p = MemHandlelock(recHandle);
> StrCopy(text,recPtr->text);
> This is also nort working...
>
Both of these problems are due to one misunderstanding. Your structure does
not contain any space to store a string. "Char * text" only declares a
pointer to Char. You have to allocate space somewhere to store the string,
and assign the address of that string to text. Also, when you write your
structure to the database, you will be saving the pointer, not the string of
characters. This is a common mistake by new C programmers, so I suggest you
get a good book on C.
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/