Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

How to get a file path?

lyricx
Beginner
535 Views
how to detect an arbitrary file's path in Fortran source code?
for example, it is a .exe file.
the following dll function can only return the path of the file generating the current process.


path_len = GetModuleFileName (NULL, path, &
len(path))


How to detect a .exe file's path, this file may not run in this time.

Thank you for your help!
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
535 Views
Well, there may be only one .exe file which started the current process, and that's the one retrieved with GetModuleFileName(NULL). If you want a currently loaded dll, use Dll name as the first argument.

If a non-exe file is not fully qualified with path, it is searched for in the current directory (e.g. OPEN(FILE="Foo.txt")). To retrieve the current directory, you can use GetCurrentDirectory.
0 Kudos
Reply