R3ExamineDir
int R3ExamineDir( char *dirname, int (*fn)(int, char *, void *), void *data);
dirname - name of the DOS directory to be examined
Return value from the callback 'fn'. Can be one of the following: -1 - Error 0 - terminate examining 1 - continue examining untill all files/directories in 'dirname' are examined.
Scans through files in given directory 'dirname'. For each found file, directory etc. DOS object, the callback 'fn' is called. The first parameter defines the type of the file (R3EDT_FILE, R3EDT_DIR), the second parameter defines the name of the object and the third parameter is user specific data passed to R3ExamineDir(). If the callback returns -1, examining is immediately terminated. If the callback returns 0, examining is terminated. The callback may want to do this, for example, when desired file is found. If the callback returns 1, examining process continues. This function is no recursive. In order to scan directories recursively, simply call R3ExamineDir() again for each encountered directory.
int print_name(int type, char *name, void *data) { printf("type: %d, name %s\n", type, name); return 1; /* continue */ } /* examine current directory */ R3ExamineDir(".", print_name, NULL);