My question is pretty simple, but I am having a hard time finding any info about this online.
Is it possible to use ifstream to open a file from assets and/or resources using Android NDK?
For example, placing a test.txt file in /assets and trying the following does not work:
char pLine[256];
std::ifstream fin("/assets/test.txt");
if(!fin.fail())
{
LOGD( "test.txt opened" );
while( !fin.eof() )
{
fin.getline( pLine, 256 );
LOGD(pLine);
}
}
else
{
LOGD( "test.txt FAILED TO OPEN!" );
}
fin.close();
Nor does any variable of:
std::ifstream fin("assets/test.txt");
std::ifstream fin("test.txt");
Etc..., nor placing it in /res instead.
So, is it possible to use normal ifstream operators to access assets and or resource files?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…