Checks if a file is empty.
l = is_empty(fname, ignoreErrors)
Where:
fname
: Name of the file to be checked.ignoreErrors
: False to print a detailed description of the error message.
Optional parameter. Default is False.It returns True if fname is an empty file and false otherwise.
The following program checks the if a file is empty:
PROGRAM is_emptyExample
USE FU_Files, ONLY: is_empty
IMPLICIT NONE
CHARACTER(LEN=:), ALLOCATABLE :: path
path='file1'
IF (is_empty(path)) THEN
WRITE(*,*) 'Empty'
ELSE
WRITE(*,*) 'Has data'
END IF
END PROGRAM is_emptyExample
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fname |
Name of the file to be checked. |
||
logical, | intent(in), | optional | :: | ignoreErrors |
False to print a detailed description of the error message. Optional parameter. Default is False. |
True if fname is an empty file. False otherwise.