Determines the full filename given a path.
l = filename(fname)
Where:
fname
: Name or path of the file the determine the filename.It returns the filename of the given path.
The following program gets the filenames of some files
PROGRAM filenameExample
USE FU_Files, ONLY: filename
IMPLICIT NONE
CHARACTER(LEN=:), ALLOCATABLE :: path
path='file1.txt'
WRITE(*,*) path, ' ', filename(path)
path='./file1.txt'
WRITE(*,*) path, ' ', filename(path)
path='/tmp/file1.txt'
WRITE(*,*) path, ' ', filename(path)
path='/tmp/file1'
WRITE(*,*) path, ' ', filename(path)
END PROGRAM filenameExample
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fname |
Filename or path to a file. |
Full filename given in the path.