Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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;
}
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #list #directory
ADD COMMENT
Topic
Name
8+9 =