Say I have a directory dirA which contains a c++ program testA and an input file fileA.txt.
testA reads file1.txt by doing something like std::ifstream inFile("./fileA.txt");.
Everythink works fine if I execute the program from within dirA in a shell.
However, if I switch do a different directory and run the program, fileA.txt cannot be found.
When I write std::ifstream inFile("./fileA.txt"); in testA,
I expected the program runs from any directory, as testA and fileA.txt are in the same directory.
However, it does only work if I run testA from dirA.
Is there a way to achieve this?