From: Cesar Rabak Newsgroups: comp.os.msdos.djgpp Subject: Re: Advance warning of failure of realloc() Date: Mon, 22 Jan 2001 23:35:29 -0200 Lines: 22 Message-ID: <3A6CDFE1.4170CCBA@uol.com.br> References: <8kjp6tohorretgu7fadnh7889ub8ihfj4d AT 4ax DOT com> NNTP-Posting-Host: 200-221-14-196.dsl-sp.uol.com.br (200.221.14.196) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 980213728 14973523 200.221.14.196 (16 [39218]) X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Save your pointer to the old memory block before attempting to realloc. See "Writing Solid Code", by S. Maguire if you want a full blown rambling in this matter. HTH Damian Yerrick wrote: > > To expand an allocated memory block, I should use realloc(). But if > realloc() fails, I lose the contents of the block, correct? How can > I prevent irretrievable data loss when calling realloc()? > > -- > ( \ GNOME vs. KDE: the game! > X http://pineight.8m.com/nes.htm > > This is McAfee VirusScan. Add these two lines to your signature to > prevent the spread of signature viruses. http://www.mcafee.com/