.\" Automatically generated by Pandoc 2.17.1.1 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. .ie "\f[CB]x\f[]"x" \{\ . ftr V B . ftr VI BI . ftr VB B . ftr VBI BI .\} .el \{\ . ftr V CR . ftr VI CI . ftr VB CB . ftr VBI CBI .\} .TH "al_for_each_fs_entry" "3alleg5" "" "Allegro reference manual" "" .hy .SH NAME .PP al_for_each_fs_entry - Allegro 5 API .SH SYNOPSIS .IP .nf \f[C] #include int al_for_each_fs_entry(ALLEGRO_FS_ENTRY *dir, int (*callback)(ALLEGRO_FS_ENTRY *dir, void *extra), void *extra) \f[R] .fi .SH DESCRIPTION .PP This function takes the ALLEGRO_FS_ENTRY(3alleg5) \f[V]dir\f[R], which should represent a directory, and looks for any other file system entries that are in it. This function will then call the callback function \f[V]callback\f[R] once for every filesystem entry in the directory \f[V]dir\f[R]. .PP The callback \f[V]callback\f[R] must be of type \f[V]int callback(ALLEGRO_FS_ENTRY * entry, void * extra)\f[R]. The \f[V]callback\f[R] will be called with a pointer to an ALLEGRO_FS_ENTRY(3alleg5) that matches one file or directory in \f[V]dir\f[R], and the pointer passed in the \f[V]extra\f[R] parameter to al_for_each_fs_entry(3alleg5). .PP When \f[V]callback\f[R] returns \f[V]ALLEGRO_FOR_EACH_FS_ENTRY_STOP\f[R] or \f[V]ALLEGRO_FOR_EACH_FS_ENTRY_ERROR\f[R], iteration will stop immediately and al_for_each_fs_entry(3alleg5) will return the value the \f[V]callback\f[R] returned. .PP When \f[V]callback\f[R] returns \f[V]ALLEGRO_FOR_EACH_FS_ENTRY_OK\f[R] iteration will continue normally, and if the ALLEGRO_FS_ENTRY(3alleg5) parameter of \f[V]callback\f[R] is a directory, al_for_each_fs_entry(3alleg5) will call itself on that directory. Therefore the function will recusively descend into that directory. .PP However, when \f[V]callback\f[R] returns \f[V]ALLEGRO_FOR_EACH_FS_ENTRY_SKIP\f[R] iteration will continue, but al_for_each_fs_entry(3alleg5) will NOT recurse into the ALLEGRO_FS_ENTRY(3alleg5) parameter of \f[V]callback\f[R] even if it is a directory. .PP This function will skip any files or directories named \f[V].\f[R] or \f[V]..\f[R] which may exist on certain platforms and may signify the current and the parent directory. The \f[V]callback\f[R] will not be called for files or directories with such a name. .PP Returns ALLEGRO_FOR_EACH_FS_ENTRY_OK if successful, or ALLEGRO_FOR_EACH_FS_ENTRY_ERROR if something went wrong in processing the directory. In that case it will use al_set_errno(3alleg5) to indicate the type of error which occurred. This function returns ALLEGRO_FOR_EACH_FS_ENTRY_STOP in case iteration was stopped by making \f[V]callback\f[R] return that value. In this case, al_set_errno(3alleg5) will not be used. .SH SEE ALSO .PP ALLEGRO_FOR_EACH_FS_ENTRY_RESULT(3alleg5) .SH SINCE .PP 5.1.9