2021-08-30

filesystem value_type pointer to string?

I have a directory_iterator and I want the filename but I can't seem to get anything to work, it just throws an error saying that value_type* cannot be converted into a string. I can't cast it to a string and std::to_string() doesn't work either!

for (auto& p : std::experimental::filesystem::directory_iterator(dir)) {
    auto path = p.path().filename().c_str();
    char f[50] = "Json/";
    std::strcpy(f, path);
    std::ifstream comp(f, std::ifstream::binary);
}


from Recent Questions - Stack Overflow https://ift.tt/3zud7yX
https://ift.tt/eA8V8J

No comments:

Post a Comment