record_length Function

public function record_length(bytes)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: bytes

Return Value integer


Contents

Source Code


Source Code

    integer function record_length(bytes)
        ! Some compilers use record lengths in units of bytes.
        ! Some compilers use record lengths in units of words.
        ! This is an utter *pain* for reading unformatted files,
        ! where you must specify the record length.
        !
        ! In:
        !    bytes: number of bytes in record type of interest (should
        !    be a multiple of 4).
        !
        ! Returns:
        !    record_length: size of record in units of the compiler's
        !    choice.
        integer, intent(in) :: bytes
        integer :: record_length_loc
        inquire(iolength=record_length_loc) bytes
        record_length = (bytes / sizeof_int) * int(record_length_loc)
! 8 indicates 8-byte words I think
    end function record_length