-next-
Loading Images

SDL has a built-in function to load BMP (BitMaP) image files. There are also examples for loading GIFs, PPMs, PCXs, and PNGs.

SDL_Surface * image;
char * file = "picture.bmp";

...

image = SDL_LoadBMP(file);

if (image == NULL)
  {
    fprintf(stderr,
            "Can't load %s: %s\n",
            file, SDL_GetError());

    exit(1);
  }

This opens a BMP file and creates a new SDL_Surface.