for_each_file(3)

NAME
for_each_file

SYNOPSIS
#include <allegro.h>

int for_each_file(const char *name, int attrib, void (*callback)(const char *filename, int attrib, int param), int param);

DESCRIPTION
Finds all the files on the disk which match the given wildcard specification and file attributes (see above), and executes callback() once for each. callback() will be passed three arguments, the first a string which contains the completed filename, the second being the attributes of the file, and the third an int which is simply a copy of param (you can use this for whatever you like). If an error occurs an error code will be stored in errno, and callback() can cause for_each_file() to abort by setting errno itself. Returns the number of successful calls made to callback().