Within c++17 there is now the ability to iterate over a directory to extract the files/folder names within it. This is incredibility easy but I've seen some really convoluted code to do this. This simple code snippet shows how to display the file names within the folder specified and all sub folders. Note that this is for VS2017 build 15.3. For other compilers the using statement may have to be changed as appropriate.

#include <iostream>
#include <string>
using namespace std;

#include <filesystem>
using namespace std::experimental::filesystem::v1;

int main(int argc, char *argv[])
	if (argc != 2)
		return !(cout << "Usage:\n" << argv[0] << " <folder name>" << endl);

	if (!exists(argv[1]))
		return !!(cout << "Directory '" << argv[1] << "' does not exist" << endl);

	for (const auto& di : recursive_directory_iterator(argv[1]))
		if (is_regular_file(di.path()))
			cout << di.path().string() << endl;