delete a file by filename
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | file | |||
| integer, | intent(out), | optional | :: | stat |
[optional] Result of remove(), 0 on success |
subroutine delete_file(file, stat) character(len=*), intent(in) :: file !> [optional] Result of remove(), 0 on success integer, optional, intent(out) :: stat logical :: exist integer :: iostat iostat = 0 inquire(file=file, exist=exist) if (exist) iostat = c_remove(file//c_null_char) if (present(stat)) stat = iostat end subroutine delete_file