> how do I get fl_get_dirlist to return a list of only the DIRECTORIES that
> exist in the path that I give? I need not see any files.. just the
> directories
Use a FL_DIRLIST_FILTER. For example:
int filter( const char *name, int type )
{
return type == FT_DIR;
}
[...]
fl_set_dirlist_filter( filter );
dl = fl_get_dirlist( somedir, "*", &nfiles, 1 );
fl_set_dirlist_filter( NULL ) /* In case we use */
/* fl_get_dirlist() */
/* elsewhere */
[...]
will return only directories in `somedir'.
As a practical matter, I'm not sure there's much of a difference
between using an unfiltered call to fl_get_dirlist and just testing:
for ( i = 0; i < nfiles; i++ )
if ( dl[i].type == FT_DIR )
handle_dir( dl[i] );
or using the filter. Internally the program still must do a stat() on
each entry in the directory and perform a test. Adding a filter seems
to me to just add a bit more complexity to the code and make what's
going on somewhat less easy to understand at first glance.
spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/