LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] C string concat question revisited

[ILUG] C string concat question revisited

Dave Neary dave.neary at palamon.ie
Thu Jul 5 10:34:37 IST 2001


Conor Daly wrote:
> 
> On Wed, Jul 04, 2001 at 10:16:47AM +0100 or so it is rumoured hereabouts,
> Dave Neary thought:
> > Conor Daly wrote:
> > >
> > > >   if (my_buf)
> > > >   {
> > > >     char *tmp = realloc(my_buf, strlen(my_buf) +
> > > >                         strlen(next_string) + 1);
> 
> The only question left here is:
> 
> Does 'tmp = realloc(my_buf,<size>);' free the block pointed to by my_buf
> while returning the address of the new block into tmp?

Yes, if the call succeeds. That's he point of realloc. If the call
fails, my_buf is unmodified.

Cheers,
Dave.

-- 
David Neary,               E-Mail dave.neary at palamon.ie
Palamon Technologies Ltd.  Phone +353-1-634-5059




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell