Hi there. I recently incorporated PhysFS in a project of mine to read the contents of archive (.zip) files. All was well until I attempted to load a text file using std::fstream. No matter what I tried, the text file could not be found.
My thinking is that al_set_physfs_file_interface() works only with Allegro-specific calls (such as al_load_bitmap() and ALLEGRO_FILE), but does not affect things outside of Allegro (such as std::fstream). Is my thinking correct?
I have attached an example that attempts to load a text file from an archive. It first uses std::fstream, and then ALLEGRO_FILE. ALLEGRO_FILE is successful, but std::fstream is not. On Linux, I am using g++ -Wall -o test main.cpp -lphysfs $(pkg-config --libs allegro-5 allegro_physfs-5) to compile from a command line.
TL;DR: Can al_set_physfs_file_interface() be used with std::fstream?
Thank you for your time.
It could be used if you wrote specialized fstream subclasses that work on ALLEGRO_FILE's or directly with PhysFS, but as is, no.
Thank you for your swift reply, Thomas.
Okay, no worries then. ALLEGRO_FILE makes things a bit easier anyhow.