hi,
i know that it is destroied, but i return its value to the function that
keeps it ok.
and still i get only 4 chars of all the date string.
why is that??????
anyone... ???
"John Leung" <[EMAIL PROTECTED]> wrote in message
news:34010@palm-dev-forum...
>
> What you have is a C programming error. Your variable
> "theConvertDate" exists only inside your function. When you exit the
> function, this variable is destroyed.
>
>
> On Sun, 24 Dec 2000 10:26:26 +0200, "Eliah NInyo" <[EMAIL PROTECTED]>
> wrote:
>
> >
> >hello,
> >
> >i have a function that should return the current date of the device. here
is
> >the function:
> >
> >static CharPtr SetAutoDate ( void )
> >{
> > DateTimeType the_date;
> > ULong DateInSec;
> > Char theConvertDate [ dateStringLength ];
> >
> > // initilize the varibles:
> >
> > // get the seconds since 1/1/1904
> > DateInSec = TimGetSeconds ();
> >
> > // gets the date and time to the_date (we don't use the time)
> > TimSecondsToDateTime ( DateInSec , &the_date );
> >
> > // convert the secounds to the current date
> > //DateSecondsToDate ( DateInSec, the_date );
> >
> > // convert the date to a string
> > DateToAscii ( the_date.month, the_date.day, the_date.year,
dfDMYWithDots,
> > theConvertDate );
> >
> > return (CharPtr)theConvertDate;
> >
> >}
> >
> >i call this function from this line:
> >
> >StrCopy ( pAutoDate, SetAutoDate() );
> >
> >pAutoDate is a CharPtr get by doing MemHandleLock.
> >
> >but it doesn't work perfectly.
> >lets say the date is 11.12.00. while i'm doing the debug thing i see that
in
> >the "theConvertDate" i get this date i want and need. but after the
"return
> >(CharPtr)theConvertDate;" i see that in "pAutoDate" there is only -
"11.1"
> >and not all the "11.12.00" that should be.
> >
> >why is that ?? can any1 find the bug??
> >
> >tnx in advance :-)
> >
> >
> >
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/