Hi
u replace ur function like this then it will work. Urs is not working
because your stuct allocated size is less than the buffer length ur trying
to copy it to your string.
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;
buffer = "FormNumberOne";
myform = (myFormStructPtr) MemPtrNew(StrLen(buffer)+1);
StrCopy(myform->formName, buffer);
...
}
thnx
nag
----- Original Message -----
From: "J�lio F�bio de O. Chagas" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Wednesday, November 21, 2001 4:36 PM
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/