I can see why
Char *encDate = "34857384573498573498";
might fail. Because you're assigning a pointer to some temp variable. It
depends on when that temp variable decides to go out of scope, that pointer
may no longer be valid. (Although I could be wrong. I'm not a C expert.)
However, I'm not sure why
Char encDate[] = "34857384573498573498";
fails. Because this time you're actually creating a variable on the stack
and initialize the content with the indicated string.
I'm sorry I couldn't help you further.
At 01:54 PM 02/04/2002 -0800, Ed wrote:
>This works ============ StrCopy(record.Date, "34857384573498573498");
>
>This fails ============= StrCopy(record.Date, encDate);
>It says that "Application just read from memory location X which is the
>unused portion of the stack. The stack is the area of RAM
>used to contain function parameters and local variables. Applications may
>access the area of the stack above the stack pointer,
>but not below it."
>
>All I want to to is get the value of encDate into record.Date. I cant see
>why this is failing unless I am missing something. Any
>ideas?
>
>Thanks,
>Ed.
>
>
>John Leung wrote:
>
> > Try replace the following line
> >
> > Char *encDate = "34857384573498573498";
> >
> > with
> >
> > Char encDate[] = "34857384573498573498";
> >
> > Also, have you ever tried the following before?
> >
> > StrCopy(record.Date, "34857384573498573498");
> >
> > >> The I can only assume what you have left out of your example, but
> with these
> > >> assumptions it is correct it should be
> > >>
> > >> typedef struct RecData {
> > >> Char Date[256];
> > >> } RecData;
> > >>
> > >> void AddToDateDatabase(RecData* v);
> > >>
> > >> void foo()
> > >> {
> > >> RecData record;
> > >> Char *encDate = "34857384573498573498";
> > >> StrCopy(record.Date, encdate); // Generally
> better
> > >> use StrNCopy() and clear out the last Char (not byte!)
> > >> error = AddToDateDatabase(&record);
> > >>
> > >> }
> > >>
>
>
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe,
>please see http://www.palmos.com/dev/support/forums/
John Leung
EMail: [EMAIL PROTECTED]
Web: http://persweb.direct.ca/jleung/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/