get_ordered_filename_array()
#
Retrieves an ordered list of filenames from a specified directory, optionally filtered by a pattern and search options.
Prototype
char **get_ordered_filename_array(
hgobj gobj,
const char *root_dir,
const char *pattern,
wd_option opt,
int *size
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
A handle to the GObj instance, used for logging and error reporting. |
|
|
The root directory from which to retrieve filenames. |
|
|
A regex pattern to filter filenames. If NULL, all files are included. |
|
|
Options for directory traversal, such as recursion and file type filtering. |
|
|
Pointer to an integer that will be set to the number of files found. |
Return Value
Returns a dynamically allocated array of strings containing the ordered filenames. The caller must free the array using free_ordered_filename_array()
.
Notes
This function uses qsort()
to sort the filenames. The returned array must be freed properly to avoid memory leaks.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples