How to read/write a txt file, without using Context to get Dir. Are there any "hardcoded" universal path. /data/data/com.project.name/file.mp3 ( .mp3 -protecting from compression) not working (crash with memory fault). Is it possible at all to using simply standard C or C++ streams in NativeActivity? All things gefinden in internet was about using JNI/JAVA or android_app structure (which i can't reach).
FILE * stream = fopen("/data/data/com.mypackage.test/save.mp3", "r");
fscanf(stream, "%s", buff); //there is segfault
fclose(stream);
//more complex way - nor crashing but opened file is empty
file.open("/data/data/com.mypackage.test/save.mp3", std::ios::in | std::ios::out);
if(!file.good())
{
file.open("/data/data/com.mypackage.test/app_Data/save.mp3", std::ios::in | std::ios::out);
if(!file.good())
file.open("/data/data/com.mypackage.test/files/save.mp3", std::ios::in | std::ios::out);
}
file>>s_buff;
file.close();
The part of code which I using. Sorry about my language skills.