fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. #define A "C:\\Program Files\\MyProg\\runner.exe"
  6. #define B "\\MyProg\\runner.exe"
  7. #define C "\\runner.exe"
  8. #define D "runner.exe"
  9.  
  10. #define MYFILE(v) &v[(std::string(v).find_last_of("\\")+1)]
  11.  
  12. int main() {
  13. std::cout << &A[(std::string(A).find_last_of("\\")+1)] << std::endl;
  14. std::cout << &B[(std::string(B).find_last_of("\\")+1)] << std::endl;
  15. std::cout << &C[(std::string(C).find_last_of("\\")+1)] << std::endl;
  16. std::cout << &D[(std::string(D).find_last_of("\\")+1)] << std::endl;
  17.  
  18. std::cout << MYFILE(A) << std::endl
  19. << MYFILE(B) << std::endl
  20. << MYFILE(C) << std::endl
  21. << MYFILE(D) << std::endl;
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
runner.exe
runner.exe
runner.exe
runner.exe
runner.exe
runner.exe
runner.exe
runner.exe