This is a repeat of a post I put on Eng-Tips about a fortnight ago.[ ] See
for that post and the replies it elicited.[ ][ ] It looks like I will not be able to achieve my aim in this matter, but I thought it worth trying this forum before I resign myself to this fate.
I am trying to get an old Fortran program to run on a modern Windows computer.[ ] Progress is slow but steady.[ ] However I have struck an "interesting" little problem.[ ] My program's *.EXE file will reside in a directory that will be chosen by the end user, with different users choosing to store it in different places.[ ] Users will run the program from a "Command Prompt" window, by typing its name and perhaps its residence directory.[ ] Thus they might type:
» ProgName[ ][ ] (if the program resides in the current working directory or in a directory that is on the system's "path")
» D:\MySoftware\etc\etc\ProgName[ ][ ] (an absolute address for the residence directory)
» ..\ProgName[ ][ ] (if the program resides in the directory above the current working directory)
I am looking for a way for the program to find out the full name of its residence directory.[ ] Gfortran has a subroutine GETCWD(cwd) that returns the full name of the directory the user is "sitting in", but I have been unable to find a way to obtain the program's residence directory.
Does anyone know of a way to achieve this?
for that post and the replies it elicited.[ ][ ] It looks like I will not be able to achieve my aim in this matter, but I thought it worth trying this forum before I resign myself to this fate.
I am trying to get an old Fortran program to run on a modern Windows computer.[ ] Progress is slow but steady.[ ] However I have struck an "interesting" little problem.[ ] My program's *.EXE file will reside in a directory that will be chosen by the end user, with different users choosing to store it in different places.[ ] Users will run the program from a "Command Prompt" window, by typing its name and perhaps its residence directory.[ ] Thus they might type:
» ProgName[ ][ ] (if the program resides in the current working directory or in a directory that is on the system's "path")
» D:\MySoftware\etc\etc\ProgName[ ][ ] (an absolute address for the residence directory)
» ..\ProgName[ ][ ] (if the program resides in the directory above the current working directory)
I am looking for a way for the program to find out the full name of its residence directory.[ ] Gfortran has a subroutine GETCWD(cwd) that returns the full name of the directory the user is "sitting in", but I have been unable to find a way to obtain the program's residence directory.
Does anyone know of a way to achieve this?