www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/31/15:35:59

From: "Patrick Chen" <pck66 AT pd DOT jaring DOT my>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: fread can't read a second time.
Date: Thu, 1 Aug 2002 01:43:55 +0800
Organization: Unconfigured
Lines: 29
Message-ID: <ai97kt$m10$1@news4.jaring.my>
References: <ai5bds$2q0$1 AT news5 DOT jaring DOT my> <3D479194 DOT 3998CB1B AT acm DOT org>
NNTP-Posting-Host: j120.crc22.jaring.my
X-Trace: news4.jaring.my 1028137437 22560 61.6.159.134 (31 Jul 2002 17:43:57 GMT)
X-Complaints-To: usenet AT news4 DOT jaring DOT my
NNTP-Posting-Date: 31 Jul 2002 17:43:57 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Thank you for responding,
    I finally get it solved. The fault pointed by the compiler at the second
fread is not the actual place of error. Error lies somewhere in the function
of the function. There were mallocs in it and possibly multiple call of
malloc cause the fault. I have them taken out and declare global for malloc
pointers and correct some other errors as well. So they run ok now.

Patrick

"Eric Sosman" <esosman AT acm DOT org> wrote in message
news:3D479194 DOT 3998CB1B AT acm DOT org...
> Patrick Chen wrote:
> > [...]
> >    When I put the second block to process the green.bmp,
> > SIGSEGV general protection fault occur at the fread of the second block.
>
>     Are you sure the second fopen() succeeds?  Notice that
> the program does *not* check for its success or failure:
>
> > fin2=fopen("green.bmp","rb");
>   ^^^^
> >     if(fin==NULL)
>          ^^^
>
> --
> Eric Sosman
> esosman AT acm DOT org


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019