Honesty, I don't understand what Viraj is talking about,
but here is the solution:
Replace StrCopy by MemMove:
MemMove(myform->formName, buffer, sizeof(myFormStruct ));
StrCopy is for null-terinated strings, not for bunary structures.
Michael
-----Original Message-----
From: Viraj Chatterjee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 21 November 2001 10:25 PM
To: Palm Developer Forum
Subject: Re: trouble with struct
> StrCopy(myform->formName, buffer);
where's the memory for formName ??
myform->formName = (Char*)MemPtrNew(MAX_SIZE * sizeof(Char));
StrCopy(............
Frankly, even the statements before the StrCopy could land you in trouble,
since you're assigning a constant string to a ptr that isn't constant...
Please go through a good book on C programming first.
-vc
----- 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/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/