GetFileParts
This routine returns the path, filename, and extension from the supplied path of the file.
Interface
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE SUBROUTINE getFileParts(chars, path, fname, ext)
CHARACTER(*), INTENT(IN) :: chars
CHARACTER(*), INTENT(OUT) :: path
CHARACTER(*), INTENT(OUT) :: fname
CHARACTER(*), INTENT(OUT) :: ext
END SUBROUTINE getFileParts
END INTERFACE
program main
use easifemBase
implicit none
CHARACTER( LEN = * ), parameter :: afile = "./HelloWorld.txt"
CHARACTER( LEN = * ), parameter :: afile2 = "/dir1/dir2/HelloWorld.txt"
CHARACTER( LEN = 100 ) :: path, name, ext
CALL GetFileParts(afile, path, name, ext)
CALL Display(path, "path = ")
CALL Display(name, "name = ")
CALL Display(ext, "ext = ")
results
path =./
name =HelloWorld
ext =.txt
CALL GetFileParts(afile, path, name, ext)
CALL Display(path, "path = ")
CALL Display(name, "name = ")
CALL Display(ext, "ext = ")
end program main
results
path =./
name =HelloWorld
ext =.txt