Hi, I’m struggling to get basic file IO working on android, using
SDL_RWops to decompress files from the .apk. Am I missing something
really obvious?
Here’s the code:
SDL_RWops *file_in = SDL_RWFromFile(filename, “rb”);
sprintf(buf, “%s/%s”, SDL_AndroidGetInternalStoragePath(),filename);
FILE *_file_out = fopen(buf, “wb”);
SDL_RWops *file_out = SDL_RWFromFP(_file_out, SDL_TRUE);
char buffer[CPBUFSIZE];
int size = SDL_RWread(file_in, buffer, 1, CPBUFSIZE);
while (size>0)
{
SDL_RWwrite(file_out, buffer, 1, size);
size = SDL_RWread(file_in, buffer, 1, CPBUFSIZE);
}
SDL_RWclose(file_out);
SDL_RWclose(file_in);
I figured it’d be easier to extract everything to internal storage so
I could leave the rest of the code the same as on other platforms.
But now I’ve tried also just loading them straight in with RWops and
there’s definitely a problem in that part.
Thanks,
M