No memory allocated for 'buffer'. No memory allocated for 'formName'.
Assigning the string to buffer without first allocating memory will cause
problems. Declaring a pointer only allocates enough memory for the variable
address, not for any data it will contain.
----- Original Message -----
From: "J�lio F�bio de O. Chagas" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Wednesday, November 21, 2001 6:06 AM
Subject: trouble with struct
> What is wrong with the code bellow ?
>
> ---definitios.h------- X ----------------------------
> typedef struct {
> Char * formName;
> } myFormStruct;
>
> typedef myFormStruct *myFormStructPtr;
> ---main.c------------- X ----------------------------
> void myFunction()
> {
> myFormStructPtr myform;
> Char *buffer;
>
> myform = (myFormStructPtr) MemPtrNew(sizeof(myFormStruct ));
> buffer = "FormNumberOne";
> StrCopy(myform->formName, buffer);
> ...
> ...
> }
>
>
>
> --
> 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/