Sprite blit (code)

the code is the following…

#include
#include <stdlib.h>
#include <SDL/SDL.h>

using namespace std;

int main(int argc, char *argv[])
{
SDL_Surface *screen, *strip, *frame;
SDL_Rect src, dest;
int cod; // function return code

/* initialize SDL /
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf(“Unable to initialize SDL: %s\n”, SDL_GetError());
exit(1);
}
/
---- */

atexit(SDL_Quit); // call SDL_Quit() whenever prg ends

/* 640x480x16bpp double_buffer /
screen = SDL_SetVideoMode(640, 480, 0, SDL_HWSURFACE|SDL_DOUBLEBUF);
if (screen == NULL) {
printf(“Unable to set video mode: %s\n”, SDL_GetError());
exit(1);
}
/
---- */

/* image loading */
SDL_Surface temp = SDL_LoadBMP(“alieno.bmp”);
if ( temp == NULL) {
printf(“unable to load %s (temp)\n”, “alieno.bmp”);
exit(0);
} else {
printf(“image loaded: %s (temp)\n”, “alieno.bmp”);
}
strip = SDL_DisplayFormat(temp);
if ( strip == NULL ) {
printf(“unable to load %s (strip)\n”, “alieno.bmp”);
exit(0);
} else {
printf(“image loaded: %s (strip)\n”, “alieno.bmp”);
}
SDL_FreeSurface(temp);
/
---- */

/* select a frame of ‘strip’ */
src.x = 0;
src.y = 0;
src.w = 100; // frame_width
src.h = 100; // frame_height
dest = src;

cod = SDL_BlitSurface(strip, &src, frame, &dest);
printf("‘strip’ flip’d on ‘frame’: %i\n", cod);

cod = SDL_BlitSurface(strip, &src, screen, &dest);
//cod = SDL_BlitSurface(frame, NULL, screen, NULL);
printf("‘frame’ flip’d on ‘screen’: %i\n", cod);

cod = SDL_Flip(screen);
printf(“flip: %i\n”, cod);

SDL_Delay(3000);
//system(“PAUSE”);
return 0;
}