SDL_GetRGB and Fatal signal: Segmentation Fault (SDL Parachute Deployed) error

Hi I have been trying to use SDL_GetRGB to get indivigual pixel
values from a bitmap immage to do some manipulations with them and
redraw a screen by plotting pixels.
The SDL_GetRGB function has been a royal pain my code compiles finaly
but I get a file stderr.txt porably a error output insted of the
printf output that goes to stdout.txt here is the error
Fatal signal: Segmentation Fault (SDL Parachute Deployed) I do not
get out a stdout.txt file I think the program just shuts down.

here is my function I may have put the values in wrong

SDL_GetRGB(pixel,fmt,&r,&g,&b);

It seemed weird but r g and b I defined as

unsigned char r,g,b;

I got pixel by
pixel = getpixel(screen,x,y);

it was defined as

unsigned long pixel=0;

I also got fmt from

SDL_PixelFormat *fmt;

please help and send a answer to @josh_wojnas I am not on the
mailing list yet.__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/

> > here is my function I may have put the values in wrong > > > SDL_GetRGB(pixel,fmt,&r,&g,&b); > > > I also got fmt from > > SDL_PixelFormat *fmt;

So in other words, “fmt” is a null pointer?

No wonder it segfaulted!

You need:

fmt = screen->format;

-bill!On Thu, Oct 24, 2002 at 06:43:30PM -0700, josh wojnas wrote: