delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/30/04:55:41

Date: Tue, 30 Jul 2002 10:36:55 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Patrick Chen <pck66 AT pd DOT jaring DOT my>
cc: djgpp AT delorie DOT com
Subject: Re: fread can't read a second time.
In-Reply-To: <ai5bds$2q0$1@news5.jaring.my>
Message-ID: <Pine.SUN.3.91.1020730103225.29085A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 30 Jul 2002, Patrick Chen wrote:

>      I have this weird problem. The first block will load a red.bmp, open
> it, get the header, pass it to process ld_memtofile along with fin to close
> it inside the function. Without the second block of open&process green.bmp,
> mb[0]->data[234} sample, did receive the right value.
>    When I put the second block to process the green.bmp,
> SIGSEGV general protection fault occur at the fread of the second block. It
> cannot transfer the data from green.bmp to file_header_ex2 even though
> fileheader_ex2 is a new char array with new fin2 which is not 0. Can some
> good people explain why this can happen and how to solve it?

I suspect that the cause of the problem is inside the function 
ld_filetomem whose source you didn't show, or in the arguments you pass 
to that function.  One thing that surely looks suspicious is this 
declaration:

	MOUSEBITMAP *mb[1];

and the fact that you pass &mb[0] and &mb[1] to ld_filetomem.  For 
starters, if mb[] has only one element, you aren't allowed to reference 
mb[1], so the above declaration should probably say mb[2].

Also, since mb[] is an array of pointers, do you really mean to pass the 
address of mb[0] and mb[1]?

- Raw text -


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