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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| path | character(len=*) | in | the file | |
| text | character(len=*) | in | its new contents | |
| stat | integer | out | nonzero on failure | |
| errmsg | character(len=:) | out | allocatable | 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