1ALLEGRO_FILE_INTERFACE(3) ALLEGRO_FILE_INTERFACE(3)
2
3
4
6 ALLEGRO_FILE_INTERFACE - Allegro 5 API
7
9 #include <allegro5/allegro.h>
10
11 typedef struct ALLEGRO_FILE_INTERFACE
12
14 A structure containing function pointers to handle a type of "file",
15 real or virtual. See the full discussion in al_set_new_file_inter‐
16 face(3).
17
18 The fields are:
19
20 void* (*fi_fopen)(const char *path, const char *mode);
21 bool (*fi_fclose)(ALLEGRO_FILE *f);
22 size_t (*fi_fread)(ALLEGRO_FILE *f, void *ptr, size_t size);
23 size_t (*fi_fwrite)(ALLEGRO_FILE *f, const void *ptr, size_t size);
24 bool (*fi_fflush)(ALLEGRO_FILE *f);
25 int64_t (*fi_ftell)(ALLEGRO_FILE *f);
26 bool (*fi_fseek)(ALLEGRO_FILE *f, int64_t offset, int whence);
27 bool (*fi_feof)(ALLEGRO_FILE *f);
28 int (*fi_ferror)(ALLEGRO_FILE *f);
29 const char * (*fi_ferrmsg)(ALLEGRO_FILE *f);
30 void (*fi_fclearerr)(ALLEGRO_FILE *f);
31 int (*fi_fungetc)(ALLEGRO_FILE *f, int c);
32 off_t (*fi_fsize)(ALLEGRO_FILE *f);
33
34 The fi_open function must allocate memory for whatever userdata struc‐
35 ture it needs. The pointer to that memory must be returned; it will
36 then be associated with the file. The other functions can access that
37 data by calling al_get_file_userdata(3) on the file handle. If fi_open
38 returns NULL then al_fopen(3) will also return NULL.
39
40 The fi_fclose function must clean up and free the userdata, but Allegro
41 will free the ALLEGRO_FILE(3) handle.
42
43 If fi_fungetc is NULL, then Allegro's default implementation of a 16
44 char long buffer will be used.
45
46
47
48Allegro reference manual ALLEGRO_FILE_INTERFACE(3)