[SDL] IMG_LoadTyped_RW parameters
Christoph Harder
shadowomf at arcor.de
Tue Aug 1 13:40:14 PDT 2006
Hello,
I'm trying to write a small game, but when I call IMG_LoadTyped_RW it
didn't work when I use std::string::c_str().
But when I use Image=IMG_LoadTyped_RW(SDL_RWFromFile(FileName.c_str(),
"rb"), 1, "TGA"); it compiles.
Why doesn't it work?
Thanks in advance,
Christoph
Code:
#include <sdl/SDL.h>
#include <sdl/SDL_image.h>
...
class filesystem{
protected:
...
public:
...
SDL_Surface loadTexture(string FileName, string FileType){
SDL_Surface *Image;
Image=IMG_LoadTyped_RW(SDL_RWFromFile(FileName.c_str(),
"rb"), 1, FileType.c_str());
return *Image;
}
}
Error:
...filesystem.h In member function `SDL_Surface
engine::filesystem::loadTexture(std::string, std::string)':
...filesystem.h invalid conversion from `const char*' to `char*'
...filesystem.h initializing argument 3 of `SDL_Surface*
IMG_LoadTyped_RW(SDL_RWops*, int, char*)'
More information about the SDL
mailing list