hi all,

In the follwing code i am not able to duplicate a string.
Do you find any problems with this code ?
Please guide me.

regards,
Dinesh.

char * strdup(char *a)
{
 UInt16 len;
 char *b;

 len = StrLen(a);
 if ( (b = MemPtrNew( len + 1 )) == NULL )
  return( NULL );
 StrCopy(b,a);
 return(b);
}


Boolean IvoxFormHandleEvent(EventPtr event)
{
...
....
   switch (event->eType) {
   case ctlSelectEvent:  // A control button was pressed and released.
  if (event->data.ctlSelect.controlID == MainRecordButton)
  {
   char *a;
   char *b;
   a = MemPtrNew(10);
   StrCopy(a,"dinesh");
   b = strdup(a);
   MemPtrFree(a);
   MemPtrFree(b);
  }
...
...
}




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

Reply via email to