Mail Archives: djgpp/2002/07/30/04:55:41
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 -