fork(3) download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <regex>
  5. using namespace std;
  6.  
  7. int main() {
  8. regex rx(":?/");
  9. string path = "L:/Dir/Directory/";
  10. vector<string> names(sregex_token_iterator(path.begin(), path.end(), rx, -1),
  11. sregex_token_iterator());
  12.  
  13. for( auto & p : names ) cout << p << endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 4324KB
stdin
Standard input is empty
stdout
L
Dir
Directory