Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Reload WRITE and READ statements

oleglebedev
New Contributor I
615 Views
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]
0 Kudos
3 Replies
Hirchert__Kurt_W
New Contributor II
615 Views
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
0 Kudos
Steven_L_Intel1
Employee
615 Views
Kurt is correct - you are asking for the User-Defined Derived Type I/O feature which we have not yet implemented.
0 Kudos
oleglebedev
New Contributor I
615 Views
Steve, Kurt,
I`ve seen this feature in some PDF about the new fortran 2003. But without explicit subroutines.
Oleg.
0 Kudos
Reply