1ALLEGRO_FILE_INTERFACE(3)  Library Functions Manual  ALLEGRO_FILE_INTERFACE(3)
2
3
4

NAME

6       ALLEGRO_FILE_INTERFACE
7

SYNOPSIS

9              #include <allegro5/allegro.h>
10
11              typedef struct ALLEGRO_FILE_INTERFACE
12

DESCRIPTION

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              void          (*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              bool          (*fi_ferror)(ALLEGRO_FILE *f);
29              void          (*fi_fclearerr)(ALLEGRO_FILE *f);
30              int           (*fi_fungetc)(ALLEGRO_FILE *f, int c);
31              off_t         (*fi_fsize)(ALLEGRO_FILE *f);
32
33       The  fi_open function must allocate memory for whatever userdata struc‐
34       ture it needs.  The pointer to that memory must be  returned;  it  will
35       then  be associated with the file.  The other functions can access that
36       data by calling al_get_file_userdata(3) on the file handle.  If fi_open
37       returns NULL then al_fopen(3) will also return NULL.
38
39       The fi_fclose function must clean up and free the userdata, but Allegro
40       will free the ALLEGRO_FILE(3) handle.
41
42       If fi_fungetc is NULL, then Allegro's default implementation  of  a  16
43       char long buffer will be used.
44
45
46
47Allegro reference manual                             ALLEGRO_FILE_INTERFACE(3)
Impressum