Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

SPLITPATHQQ

Portability Function: Breaks a file path or directory path into its components.

Module

USE IFPORT

result = SPLITPATHQQ (path,drive,dir,name,ext)

path

(Input) Character*(*). Path to be broken into components. Forward slashes (/), backslashes (\), or both can be present in path.

drive

(Output) Character*(*). Drive letter followed by a colon.

dir

(Output) Character*(*). Path of directories, including the trailing slash.

name

(Output) Character*(*). Name of file or, if no file is specified in path, name of the lowest directory. A file name must not include an extension.

ext

(Output) Character*(*). File name extension, if any, including the leading period (.).

Results

The result type is INTEGER(4). The result is the length of dir.

The path parameter can be a complete or partial file specification.

$MAXPATH is a symbolic constant defined in module IFPORT.F90 as 260.

Example


 USE IFPORT
 CHARACTER($MAXPATH) buf
 CHARACTER(3)        drive
 CHARACTER(256)      dir
 CHARACTER(256)      name
 CHARACTER(256)      ext
 CHARACTER(256)      file

 INTEGER(4)          length

 buf = 'b:\fortran\test\runtime\tsplit.for'
 length = SPLITPATHQQ(buf, drive, dir, name, ext)
 WRITE(*,*) drive, dir, name, ext
 file = 'partial.f90'
 length = SPLITPATHQQ(file, drive, dir, name, ext)
 WRITE(*,*) drive, dir, name, ext

 END

See Also