Answers for "how to list directory in c++"

C++
0

how to list directory in c++

#include <iostream>
#include <vector>
#include <string>
#include <filesystem>

using std::cout; using std::cin;
using std::endl; using std::string;
using std::filesystem::recursive_directory_iterator;

int main() {
    string path = "./";

    for (const auto & file : recursive_directory_iterator(path))
        cout << file.path() << endl;

    return EXIT_SUCCESS;
}
Posted by: Guest on April-27-2022
0

how to list directory in c++

#include <iostream>
#include <vector>
#include <string>
#include <filesystem>

using std::cout; using std::cin;
using std::endl; using std::string;
using std::filesystem::recursive_directory_iterator;

int main() {
    string path = "./";

    for (const auto & file : recursive_directory_iterator(path))
        cout << file.path() << endl;

    return EXIT_SUCCESS;
}
Posted by: Guest on April-27-2022

Code answers related to "how to list directory in c++"

Browse Popular Code Answers by Language