is_path_absolute Function

public function is_path_absolute(fname) result(res)

Determines if a path is absolute or not. Returns True if path is absolute and False if path is relative.

Syntax

 l = is_path_absolute(fname)

Where:

  • fname: Name of the path to be checked.

It returns True if fname is an absolute path and false otherwise.

Example

The following program checks the if some paths are absolute or not:

 PROGRAM is_path_absoluteExample
    USE FU_Files, ONLY: is_path_absolute
    IMPLICIT NONE
    CHARACTER(LEN=:), ALLOCATABLE :: path
    path='file1'
    WRITE(*,*) path, is_path_absolute(path)
    path='./file1'
    WRITE(*,*) path, is_path_absolute(path)
    path='/tmp/file1'
    WRITE(*,*) path, is_path_absolute(path)
 END PROGRAM is_path_absoluteExample

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: fname

Path to a file.

Return Value logical

True if the path is absolute and false if the path is relative.


Contents