#include#include namespace fs = std::filesystem; int main() { // Create a path to a file fs::path filePath("C:/Users/username/Documents/myfile.txt"); std::cout << "File path: " << filePath << std::endl; // Create a path to a directory fs::path directoryPath("C:/Users/username/Documents/myfolder"); std::cout << "Directory path: " << directoryPath << std::endl; // Combine paths fs::path combinedPath = directoryPath / filePath.filename(); std::cout << "Combined path: " << combinedPath << std::endl; // Check if path exists if (fs::exists(filePath)) { std::cout << "File exists!" << std::endl; } else { std::cout << "File does not exist :(" << std::endl; } return 0; }
#include