lookfor(3f) - [M_io:SCANNAMES] look for a filename in a number of directories specified by an environment variable (LICENSE:PD)
Syntax
Description
Options
Returns
Examples
See Also
Author
License
function lookfor(basename,env) result(pathname)
character(len=:),intent(in) :: basename character(len=:),intent(in) :: env character(len=:),allocatable :: pathname
Given a base filename find the first file with that name in the directories specified by the environment variable ENV
BASENAME the file to search for ENV environment variable name. Separator between directory names is assumed to be a colon on ULS (Unix-Like Systems) and semi-colon on MS-Windows machines.
PATHNAME the first pathname found in the current user path. Returns blank if the file is not found.
Sample program:
program demo_lookfor use M_io, only : lookfor implicit none character(len=:),allocatable :: returned returned=lookfor(ls,PATH) write(*,*)ls is ,returned returned=lookfor(dir.exe,PATH) write(*,*)dir is ,returned end program demo_lookfor
M_system:system_dir(3f)
John S. Urban
Public Domain
Nemo Release 3.1 | lookfor (3) | February 23, 2025 |