I'm sorry if my terminology might be wrong but I have an example code here using the "filesystem" library where it displays all the directory contents and its sub-contents using a for loop and it uses an auto type variable 'p'. I want to convert that into a string to store in a string variable. Is there any way to do this?
#include <filesystem>
namespace fs = std::experimental::filesystem;
int main()
{
std::string path = "c:\\home\\...some directory";
for (auto & p : fs::recursive_directory_iterator(path))
{
std::cout << p << std::endl;
}
system("pause");
}