Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Android: how to open an assets file?

This thread is locked; no one can reply to it. rss feed Print
Android: how to open an assets file?
weeboe
Member #14,848
January 2013

Should be easy, but does not work:

al_android_set_apk_file_interface();
ALLEGRO_FILE *f=al_fopen("myFile","rb");
int fsize=al_fsize(f);

The result: f is not 0, but it shows no content either. The value of fsize = 0. What's wrong?

PS
Maybe this is a wrong question. The "myFile" actually was a .ttf fontfile. I saw in the allegro source code that allegro tries to classify files by means of their extension. Maybe a .ttf file is refused because in case of Android there is no handler for it? Anyhow, I tried to do the same with a normal text file and that worked perfectly. Anybody any idea?

PS2
I also tried a build-in font:

ALLEGRO_FILE *ttf_file=al_fopen("/system/fonts/DroidSans.ttf","rb");

Same result: the file could be opened, but its size was zero.

PS3
Using FILE instead of ALLEGRO_FILE works. I'll submit a bug.

Go to: