1#include <string>
2#include <iostream>
3#include <filesystem>
4namespace fs = std::filesystem;
5
6int main() {
7 std::string path = "/path/to/directory";
8 for (const auto & entry : fs::directory_iterator(path))
9 std::cout << entry.path() << std::endl;
10}
1#include <dirent.h>
2
3std::vector<std::string> GetRecords()
4{
5 std::vector<std::string> files;
6 struct dirent *entry;
7 DIR *dir = opendir(record_dir_path.c_str());
8
9 if (dir == NULL)
10 {
11 return files;
12 }
13 while ((entry = readdir(dir)) != NULL)
14 {
15 files.push_back(entry->d_name);
16 }
17 closedir(dir);
18
19 return files;
20}