SDL 2.0 Andriod (Reading and Writing to Txt Files )

How does one do this? I can load the images and music perfectly fine.

What about txt files to save settings and load data?

There’s all what you need: http://wiki.libsdl.org/SDL_RWops

Using SDL_RWops as Flash suggests will pull data from the "assets"
directory in your APK. That’s what you need for loading. If you want to
save settings, you need to store them elsewhere. I
use SDL_AndroidGetInternalStoragePath() to locate where I can save files.
There’s also SDL_GetPrefPath(), which should to do the same thing but
without being specific to Android.

Jonny DOn Fri, Jan 17, 2014 at 4:37 AM, Flash wrote:

There’s all what you need: http://wiki.libsdl.org/SDL_RWops


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Flash wrote:

There’s all what you need: http://wiki.libsdl.org/SDL_RWops

I thought this would work for my already existing windows code, but I’m unable to find a way to use this pointer for a std::ifstream object, so I can use the getline() function.

Is there some other way of doing this? Or will have to use the RWops, then manually code functions to parse each line?

Just load the whole file into RAM with SDL_RWops and then use a
std::istringstream to parse it.On 18.01.2014 06:44, ronkrepps wrote:

Flash wrote:

There’s all what you need: http://wiki.libsdl.org/SDL_RWops

I thought this would work for my already existing windows code, but
I’m unable to find a way to use this pointer for a std::ifstream
object, so I can use the getline() function.

Is there some other way of doing this? Or will have to use the RWops,
then manually code functions to parse each line?


Rainer Deyke (rainerd at eldwood.com)