Subj : Re: malloc() To : borland.public.cpp.borlandcpp From : Sebastian Ledesma Date : Wed Jun 23 2004 02:03 pm Jan: Can you try something like this? int n=strlen( szInput ); if ( n > strlen( txtBuf )) { char *p=realloc ( strlen( szInput ) + 1 ); if (p) txtBuf=p; else n=sizeof(txtBuf )-1; //assuming 1 char wide :-) } strncpy( txtBuf, szInput , n); txtBuf[n]='\0'; Saludos Sebastian .