SDL_RWFromConstMem

Name

SDL_RWFromConstMem -- prepares a constant memory area for use with RWops.

Synopsis

#include "SDL.h"

SDL_RWops *SDL_RWFromConstMem(const void *mem, int size);

Description

SDL_RWFromConstMem sets up a RWops struct based on a memory area of a certain size. It assumes the memory area is not writable.

Return Value

Returns a pointer to a new RWops struct, or NULL if it fails.

Example

char bitmap[] = {
    66, 77, 86, 2, 0, 0, 0, 0 ...
}
SDL_RWops *rw;
SDL_Surface *img;

rw = SDL_RWFromConstMem(bitmap, sizeof(bitmap));
img = SDL_LoadBMP_RW(rw, 1); // Automatically frees the RWops struct for us

// Do something with img...

See Also

SDL_RWFromMem, SDL_FreeRW

SDL_RWFromConstMem (last edited 2009-06-15 19:18:33 by 82-171-113-142)