Function rcutils_dir_iter_start

Function Documentation

rcutils_dir_iter_t *rcutils_dir_iter_start(const char *directory_path, const rcutils_allocator_t allocator)

Begin iterating over the contents of the specified directory.

This function is used to list the files and directories that are contained in a specified directory. The structure returned by it must be deallocated using rcutils_dir_iter_end when the iteration is completed. The name of the enumerated entry is stored in the entry_name member of the returned object, and the first entry is already populated upon completion of this function. To populate the entry with the name of the next entry, use the rcutils_dir_iter_next function. Note that the “.” and “..” entries are typically among the entries enumerated.

Parameters:
  • directory_path[in] The directory path to iterate over the contents of.

  • allocator[in] Allocator used to create the returned structure.

Returns:

An iterator object used to continue iterating directory contents

Returns:

NULL if an error occurred