FileNew Subroutine

public subroutine FileNew(file)

create a new text file

Arguments

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

Variables

Type Visibility Attributes Name Initial
character(len=100), public :: cmd

Source Code

SUBROUTINE FileNew &
!
(file)

IMPLICIT NONE

!Arguments with intent(in):
CHARACTER (LEN = *), INTENT(IN) :: file 

! Local declarations:  
CHARACTER (LEN = 100)      :: cmd
!------------end of declaration------------------------------------------------

IF (.NOT. FileExists (file) ) THEN
   
IF (GetOS () == WIN32) THEN!detected Windows OS
    cmd = 'CD.>' // file
    CALL System (cmd)
ELSE !detected unix like OS, including linux
    cmd = 'touch ' // file
    CALL System (cmd)
END IF

END IF

END SUBROUTINE FileNew