Hi,

I have a similar code developing in CW v9.0 like the following (simplified) :

static Boolean SatLogFormHandleEvent( EventPtr event )
{
char *filename;
char temp[5];
...
...
switch ( event->eType )
  ...
  ...
  case ctlSelectEvent:
       filename=0;
       filename=NULL;
       filename="";
       ...
       /* put the year, month, day, hour, minute, second after *filename
using StrCat*/
       ...
       StrCat(filename,temp);
       ...
       /*the complete filename*/
}

When I debug my code with CW v9.0 IDE, the first selection of this event
has no problem, a right filename is displayed in the debug window of CW and
a label in a form. However, the second selection of the same event has a
problem as follow:

the line: filename=0;            CW debug window shows filename is a
"invalid pointer " , which is right.
the line: filename=NULL;      CW debug window shows filename is a "invalid
pointer " , which is right.
the line: filename="";           CW debug window shows filename is the same
as the complete filename of previous file, which is wrong,
and                             *filename= '0' (it was *filename='/' in the first run)

Why the second run of the above event restores the same filename of the
first run even after reinitialization? Would it be the problem of using
StrCat() or handling and freeing memory of pointer? Or, would it be a bug
of CW v9?

Anyone knows why and how to fix this problem.
Many thanks.





--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to