fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

filename_list.cxx File Reference
#include <FL/filename.H>
#include <FL/fl_utf8.h>
#include "flstring.h"
#include <stdlib.h>
Include dependency graph for filename_list.cxx:

Go to the source code of this file.

Functions

int fl_scandir (const char *dir, dirent ***namelist, int(*select)(dirent *), int(*compar)(dirent **, dirent **))
 
int fl_alphasort (struct dirent **a, struct dirent **b)
 
int fl_casealphasort (struct dirent **a, struct dirent **b)
 
int fl_filename_list (const char *d, dirent ***list, Fl_File_Sort_F *sort)
 
void fl_filename_free_list (struct dirent ***list, int n)
 Free the list of filenames that is generated by fl_filename_list(). More...
 

Function Documentation

◆ fl_filename_free_list()

void fl_filename_free_list ( struct dirent ***  list,
int  n 
)

Free the list of filenames that is generated by fl_filename_list().

Free everything that was allocated by a previous call to fl_filename_list(). Use the return values as parameters for this function.

Parameters
[in,out]listtable containing the resulting directory listing
[in]nnumber of entries in the list

Definition at line 189 of file filename_list.cxx.

References free().

◆ fl_filename_list()

int fl_filename_list ( const char *  d,
dirent ***  list,
Fl_File_Sort_F sort 
)

Portable and const-correct wrapper for the scandir() function. For each file in that directory a "dirent" structure is created. The only portable thing about a dirent is that dirent.d_name is the nul-terminated file name. An pointers array to these dirent's is created and a pointer to the array is returned in *list. The number of entries is given as a return value. If there is an error reading the directory a number less than zero is returned, and errno has the reason; errno does not work under WIN32.

Include:

#include <FL/filename.H>
Parameters
[in]dthe name of the directory to list. It does not matter if it has a trailing slash.
[out]listtable containing the resulting directory listing
[in]sortsorting functor:
  • fl_alphasort: The files are sorted in ascending alphabetical order; upper and lowercase letters are compared according to their ASCII ordering uppercase before lowercase.
  • fl_casealphasort: The files are sorted in ascending alphabetical order; upper and lowercase letters are compared equally case is not significant.
  • fl_casenumericsort: The files are sorted in ascending "alphanumeric" order, where an attempt is made to put unpadded numbers in consecutive order; upper and lowercase letters are compared equally case is not significant.
  • fl_numericsort: The files are sorted in ascending "alphanumeric" order, where an attempt is made to put unpadded numbers in consecutive order; upper and lowercase letters are compared according to their ASCII ordering - uppercase before lowercase.
Returns
the number of entries if no error, a negative value otherwise.

Definition at line 75 of file filename_list.cxx.

References dirent, fl_filename_isdir(), FL_PATH_MAX, fl_scandir(), fl_utf8from_mb(), fl_utf8to_mb(), free(), malloc(), name, NULL, and sort().

Referenced by Fl_File_Browser::load(), load_kde_icons(), Fl_Plugin_Manager::loadAll(), and template_load().

◆ fl_scandir()

int fl_scandir ( const char *  dir,
dirent ***  namelist,
int(*)(dirent *)  select,
int(*)(dirent **, dirent **)  compar 
)

Referenced by fl_filename_list().

filename.H