#includenamespace fs = std::filesystem; int main() { fs::create_directory("mydir"); return 0; }
#includenamespace fs = std::filesystem; int main() { fs::rename("oldname.txt", "newname.txt"); return 0; }
#includeIn this example, we check if a file named "myfile.txt" exists using the `exists` function. These examples use the std::filesystem library, which is available in C++17 and later.namespace fs = std::filesystem; int main() { if (fs::exists("myfile.txt")) { // Do something } return 0; }