Although you supplied enough code (which most people forget to do), you
never really state what the problem  is ... so what are the symptoms?  Is
the failure in strdup(), or with what it returns?Have you stepped through
strdup() in the debugger?

--
-Richard M. Hartman
[EMAIL PROTECTED]

186,000 mi/sec: not just a good idea, it's the LAW!


Dinesh wrote in message <13852@palm-dev-forum>...
>
>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