Skip to content

Instantly share code, notes, and snippets.

@regehr
Created May 30, 2019 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save regehr/fdf82768f25c9b15d549dd5057be2532 to your computer and use it in GitHub Desktop.
Save regehr/fdf82768f25c9b15d549dd5057be2532 to your computer and use it in GitHub Desktop.
#include <filesystem>
#include <iostream>
namespace fs = std::filesystem;
using namespace std;
int main() {
fs::path aPath{"./path/to/file.txt"};
cout << "Parent path: " << aPath.parent_path() << endl;
cout << "Filename: " << aPath.filename() << endl;
cout << "Extension: " << aPath.extension() << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment