Mail Archives: djgpp/1997/07/10/10:00:41
On 9 Jul 1997 levity AT minn DOT net wrote:
> I am writing a program for the purpous of learing how to read binary files.
> I am using the modulus fo counting coloms for the out put but every time I
> add the code to do this the program runs and then ends with a general
> protection fault. Any ideas why I am getting the general protection fault?
> Also for future reference should I include my code in a different way when
> posting these questions?
>
> #include <stdio.h>
> #include <stdlib.h>
> #include ".\bmphead.h"
>
>
>
> int main(int argc, char *argv[])
> {
>
> long pal[3][256];
> pal[3][i] = palette.Pad;
^^^
Here is your problem, pal is defined as long pal[3][256], the first
dimension has only three elements, numbered 0, 1, & 2 there is no pal[3]...
> (void)printf("%ld,%ld,%ld,%ld |\n", pal[0][i], pal[1][i], pal[2][i],
> pal[3][i]);
^^^ -- No pal[3]...
> }
> else
> (void)printf("%ld,%ld,%ld,%ld |", pal[0][i], pal[1][i], pal[2][i],
> pal[3][i]);
^^^ -- No pal[3]...
>
Art S. Kagel, kagel AT bloomberg DOT com
- Raw text -