Android: how to open an assets file?

Should be easy, but does not work:

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?

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?

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.

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

Thread #611868. Printed from