--- Keith wrote:
>  ...
>  MemMove(item.DevStatus, record.DevStatus, record.StatusLen); <--
>  ...
> 
> typedef struct
> {
>      UInt8   SysType;
>      ...
>      CharPtr   DevStatus;
> } dbRecordItemType
> 
> everytime when the sentense i point out (<--) 
> ... SysFatalAlert came out.
> 

I am tempted to ask, "doesn't anybody know anything about C?" but then
again, I've made worse mistakes myself.

Keith,

Your structure does not contain any space to hold a string.  Your
structure contains space for a pointer to a string (CharPtr DevStatus).
 If you want to move (copy, really) the bytes of a string of characters
somewhere, you have to have space there to store them.  For example,

// this won't work
CharPtr msg;
StrCopy(msg, "Don't try this!")

// this will work
Char msg[11];
StrCopy(msg, "This is OK");

// this will also work
CharPtr msg;
msg = (CharPtr)MemPtrNew(11);
StrCopy(msg, "This is OK");
//when done with msg: MemPtrFree(msg);

If this doesn't make sense to you, please get yourself a good book on
the C programming language.


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to