1al_for_each_fs_entry(3)                                al_for_each_fs_entry(3)
2
3
4

NAME

6       al_for_each_fs_entry - Allegro 5 API
7

SYNOPSIS

9              #include <allegro5/allegro.h>
10
11              int al_for_each_fs_entry(ALLEGRO_FS_ENTRY *dir,
12                                       int (*callback)(ALLEGRO_FS_ENTRY *dir, void *extra),
13                                       void *extra)
14

DESCRIPTION

16       This function takes the ALLEGRO_FS_ENTRY(3) dir, which should represent
17       a directory, and looks for any other file system entries  that  are  in
18       it.   This  function will then call the callback function callback once
19       for every filesystem entry in the directory dir.
20
21       The callback callback must be of type int  callback(ALLEGRO_FS_ENTRY  *
22       entry, void * extra).  The callback will be called with a pointer to an
23       ALLEGRO_FS_ENTRY(3) that matches one file or directory in dir, and  the
24       pointer passed in the extra parameter to al_for_each_fs_entry(3).
25
26       When   callback   returns   ALLEGRO_FOR_EACH_FS_ENTRY_STOP   or   ALLE‐
27       GRO_FOR_EACH_FS_ENTRY_ERROR,  iteration  will  stop   immediately   and
28       al_for_each_fs_entry(3) will return the value the callback returned.
29
30       When  callback returns ALLEGRO_FOR_EACH_FS_ENTRY_OK iteration will con‐
31       tinue normally, and if the ALLEGRO_FS_ENTRY(3) parameter of callback is
32       a  directory, al_for_each_fs_entry(3) will call itself on that directo‐
33       ry.  Therefore the function will recusively descend into that  directo‐
34       ry.
35
36       However, when callback returns ALLEGRO_FOR_EACH_FS_ENTRY_SKIP iteration
37       will continue, but al_for_each_fs_entry(3) will NOT  recurse  into  the
38       ALLEGRO_FS_ENTRY(3) parameter of callback even if it is a directory.
39
40       This  function  will  skip any files or directories named . or .. which
41       may exist on certain platforms and may signify the current and the par‐
42       ent  directory.   The callback will not be called for files or directo‐
43       ries with such a name.
44
45       Returns   ALLEGRO_FOR_EACH_FS_ENTRY_OK   if   successful,   or    ALLE‐
46       GRO_FOR_EACH_FS_ENTRY_ERROR  if  something went wrong in processing the
47       directory.  In that case it will use al_set_errno(3)  to  indicate  the
48       type   of   error   which   occurred.    This  function  returns  ALLE‐
49       GRO_FOR_EACH_FS_ENTRY_STOP in case  iteration  was  stopped  by  making
50       callback  return that value.  In this case, al_set_errno(3) will not be
51       used.
52

SEE ALSO

54       ALLEGRO_FOR_EACH_FS_ENTRY_RESULT(3)
55

SINCE

57       5.1.9
58
59
60
61Allegro reference manual                               al_for_each_fs_entry(3)
Impressum