Been a long time since I used C++ and came across something in some code I was reading today:
Why doesn't exists
below need qualifying with std::filesystem::
. I've not been able to work out how that prefix is inferred (partly as I don't even know what to search for).
#include <iostream>
#include <filesystem>
int main()
{
std::filesystem::path input_path("c:\\temp\\foo.txt");
std::error_code fs_error;
if (!exists(input_path, fs_error))
{
std::cout << "Error: folder or file " << input_path << " doesn't exist" << std::endl;
}
}