Good day,
I would like to find out, is it possible to reload the (un-) formatted write and read statements to a derived type variable? I mean something like this
[fortran]MODULE reloadWrite_module IMPLICIT NONE ! public :: write !(formatted) !public :: write(formatted) ! private :: write_some_formatted ! type :: some integer :: age character(Len=10) :: firstName character(Len=10) :: lastName end type some ! INTERFACE write !(formatted) MODULE PROCEDURE write_some_formatted END INTERFACE ! CONTAINS ! subroutine write_some_formatted(this) implicit none type(some), intent(IN) :: this write( *, 1 ) "person ", "first name is ", this%firstName, "last name is ", this%lastName, "age is ", this%age 1 format ( :, 1X, A,/, 2(2(A),/), A,i3 ) return end subroutine write_some_formatted END MODULE reloadWrite_module[/fortran]
链接已复制
3 回复数
The 2003 and 2008 Fortran standards include the concept of user-defined derived-type input/output procedures (UDDTIOPs for short). I think this is what you are asking for. One of the Intel people should be able to confirm one way or the other, but I believe that I read in this forum that UDDTIOPs have not yet been implemented in ifort.
-Kurt
-Kurt
