[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Realloc



Martin wrote:
> 
> Hej
> 
> Jag sitter och skriver ett program som läser från ett modem. Efterhand som den inlästa bufferten börjar bli full så expanderar jag den. På följande sätt:
> 
> Ptr2 = (char *) realloc(Ptr, ll);
> 
> Ptr är buffertem som jag vill öka och ll är den nya storleken på bufferten. Detta fungerar oftast. Men i detta fallet slocknar programmet. realloc lämnar inget felmeddelande utan krachar bara. Jag får inte heller någon core-dump.
> 
> Jag vet att Ptr != NULL och ll är ett rimligt tal. Så det borde inte hända.
> 
> Någon som vet vad detta kan bero på?

Kan det være fordi du refererer til Ptr og ikke Ptr2 efter realloc?

Mogens 

-- 
Mogens Kjaer, Carlsberg Laboratory, Dept. of Chemistry
Gamle Carlsberg Vej 10, DK-2500 Valby, Denmark
Phone: +45 33 27 53 25, Fax: +45 33 27 47 08
Email: sslug@sslug Homepage: http://www.crc.dk


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *