Peter
Is your function use something like this:
// load sample.png into image
SDL_Surface *image;
SDL_RWops *rwop;
rwop=SDL_RWFromFile("sample.png", "rb");
image=IMG_LoadPNG_RW(rwop);
if(!image) {
printf("IMG_LoadPNG_RW: %s\n", IMG_GetError());
// handle error
}