0

I'm writing a program which calls a separate perl file using the system() call to search an online database, and then returns to the c++ program to finish analyzing the database.

When I create an object file for the c++ program, and then click on it to run it, it runs it from the home directory in the terminal, but the perl file isn't stored there, and so it gives me an error that the file cannot be found. Is there any way that I can run the c++ program from the directory in which it is stored rather than the default directory, and make it so that it always runs from where it is stored?

Garf365
  • 3,619
  • 5
  • 29
  • 41
  • If you want to launch a program from the directory itself, you can best preceed it by a dot: `./program.exe`. Another way is to add `.` to the `PATH` environment variable. – Dominique May 26 '16 at 10:11
  • Alternative is to specify the absolute path of the perl file in your c++ code. – Zafi May 26 '16 at 10:11

0 Answers0