I have a C++ project for which I have generated an .exe.
The program has some code as following:
system(TestApplication.exe input.txt output.txt)
system(TestApplication1.exe input1.txt output1.txt)
system(TestApplication2.exe input2.txt output2.txt)
I actually tried keeping the .exe’s inside another folder in the project directory i.e. (EXEs) and files in another one (Data).
It actually cannot find the files if the path for exe is changed. I think there’s a problem in changing the path in system as since it tells that EXEs is not a recognized command:
system("EXEs/TestApplication1.exe .... )
How is the path changed for the system command in C++?
Assume your Project directory is set as
and your executable is inside the project directory and it is inside the folder
Then what you can do is always use the PROJECT_DIR to locate your executable like