al_register_bitmap_identifier(1) Allegro 5 API


#include <allegro5/allegro.h>
bool al_register_bitmap_identifier(const char *extension,
   bool (*identifier)(ALLEGRO_FILE *f))


Register an identify handler for al_identify_bitmap(3alleg5). The given function will be used to detect files for the given extension. It will be called with a single argument of type ALLEGRO_FILE(3alleg5) which is a file handle opened for reading and located at the first byte of the file. The handler should try to read as few bytes as possible to safely determine if the given file contents correspond to the type with the extension and return true in that case, false otherwise. The file handle must not be closed but there is no need to reset it to the beginning.

The extension should include the leading dot ('.') character. It will be matched case-insensitively.

The identifier argument may be NULL to unregister an entry.

Returns true on success, false on error. Returns false if unregistering an entry that doesn't exist.