fdoc

subroutinewrite_whole_file

subroutine write_whole_file(path, text, stat, errmsg)

Replace the contents of file path. This can be called from parallel code.

Arguments

NameTypeIntentAttributesDescription
pathcharacter(len=*)in

the file

textcharacter(len=*)in

its new contents

statintegerout

nonzero on failure

errmsgcharacter(len=:)outallocatable

what is wrong

Source

Show the code
subroutine write_whole_file(path, text, stat, errmsg)
    character(len=*), intent(in) :: path                    !! the file
    character(len=*), intent(in) :: text                    !! its new contents
    integer, intent(out) :: stat                            !! nonzero on failure
    character(len=:), allocatable, intent(out) :: errmsg    !! what is wrong

    !$omp critical (file_io)
    call write_file(path, text, stat, errmsg)
    !$omp end critical (file_io)
end subroutine write_whole_file

Graphs

Called by