Hi Everyone,
Before stating my question i’ll give some backround information. I am using Fortran 77 with the gfortran compiler (version 3.6.0). I am working on some routines not written by me which are then called in a matlab main code.
So, i have a question on how Fortran handles files and directories. Right now i know that by using the OPEN statement i need to specify the exact directory of the files i wish to read or to write on. Now, my intent is to be able to create an executable that can access files in any directory in which is called by the matlab main code.
As an example, lets say that the executable is kept in a folder called Executable, while the matlab main is kept inside the folder MAIN CODE together with the two files named Inputs and Outputs. What i want to be able to do is for the executable to be able to find and read the Inputs file without specifying inside the OPEN statement the full directory (similarly with the Outputs file); as if i did so, then the executable will only be working if the matlab main code were to reside inside the MAIN CODE folder.
Now, i know for a fact that this is in theory possible. The executables that were passed to me work this way. However, when i compile it myself with some corrections this functionality is lost and i have no idea on why since my corrections are absolutely minor (one line) and does not at all regard the opening, reading and writing of the files.
I hope i’ve been clear in stating my problem. In any case, let me know if i was not, i’ll try to make myself clearer. Thanks for the attention!
Best regards,
Giulio